160Part IIIDocument Objects (Web design templates) Referenceprototype. Scripts can freely override

160Part IIIDocument Objects Referenceprototype. Scripts can freely override prototype property values or assign differentfunctions to prototype methods in a working object if desired without affecting thestatic object prototype. But if inherited properties or methods are not modified in thecurrent working object, any changes to the static object s prototype are reflected in theworking object. (The mechanism is that a reference to an object s property works itsway up the prototype inheritance chain to find a match to the property name.) .JavaScript includes a large set of operators.You can find most operators that you areaccustomed to working with in other languages. .JavaScript provides typical control structures.All versions of JavaScript offer if, if-else, for, and whileconstructions. JavaScript 1.2 (NN4+ and IE4+) added do-whileand switchconstructions. Iteration constructions provide breakand continuestatements to modify control structure execution. .JavaScript functions may or may not return a value.There is only one kind ofJavaScript function. A value is returned only if the function includes a returnkeywordfollowed by the value to be returned. Return values can be of any data type. .JavaScript functions cannot be overloaded.A JavaScript function accepts zero or morearguments, regardless of the number of parameter variables defined for the function. Allarguments are automatically assigned to the argumentsarray, which is a property of afunction object. Parameter variable data types are not predefined. .Values are passed by reference and by value. An object passed to a function isactually a reference to that object, offering full read/write access to properties and meth- ods of that object. But other types of values (including object properties) are passed byvalue, with no reference chain to the original object. Thus, the following nonsense frag- ment empties the text box when the onchangeevent fires: function emptyMe(arg1) { arg1.value = ; } … But in the following version, nothing happens to the text box: function emptyMe(arg1) { arg1 = ; } … The local variable (arg1) simply changes from Howdy to an empty string. .Error trapping techniques depend on JavaScript version.There is no error trappingin NN2 or IE3. Error trapping in NN3, NN4, and IE4 is event-driven in the Web browserobject model. JavaScript, as implemented in IE5+ and Moz1+, Safari, and other recentbrowsers, supports try-catchand throwstatements, as well as built-in error objectsthat are not dependent on the host environment. .Memory management is not under script control.The host environment managesmemory allocation, including garbage collection. Different browsers may handle mem- ory in different ways. .White space (other than a line terminator) is insignificant.Space and tab charactersmay separate lexical units (for example, keywords, identifiers, and so on).