This section describes the following new objects and changes to existing objects:
In addition, objects can now be creating using literal notation.
In addition to creating an object using its constructor function, you can create it using literal notation.
objectName = {property1:value1, property2:value2,..., propertyn:valuen}
objectName is the name of the new object
propertyn is a property.
valuen is the value assigned to the propertyn.
JavaScript interprets objects created through literal notation once only, when the HTML page is loaded.
The following example creates myHonda with three properties. Note that the engine property is also an object with its own properties.
myHonda = {color:"red",wheels:4,engine:{cylinders:4,size:2.2}}
Core object. The arguments array object provides information about a function at the time the function is invoked. In previous JavaScript versions, arguments provided a list of indexed elements and a length property. In JavaScript 1.2, arguments includes these additional properties:
For example, the following script demonstrates several of the arguments properties;
<SCRIPT> function b(z) { document.write(arguments.z + "<BR>") document.write (arguments.caller.x + "<BR>") return 99 } function a(x, y) { return b(534) } document.write (a(2,3) + "<BR>")
</SCRIPT>
This writes:
534
2
99
534 is the actual parameter to b, so it is the value of arguments.z
2 is a's actual x parameter, so (viewed within b) it is the value of arguments.caller.x.
99 is what a(2,3) returns.
Core object. Number(x) now produces NaN rather than an error if x is a string that does not contain a well-formed numeric literal. For example,
x=Number("three"); document.write(x + "<BR>");
prints NaN
Client-side object. Contains information about the display screen resolution and colors.
screen.propertyName
propertyName is one of the properties listed below.
None
Property | Description |
availHeight | Specifies the height of the screen, in pixels, minus permanent or semi-permanent user interface features displayed by the operating system, such as the Taskbar on Windows. |
availWidth | Specifies the width of the screen, in pixels, minus permanent or semi-permanent user interface features displayed by the operating system, such as the Taskbar on Windows. |
height | Specifies the height of the screen in pixels. |
width | Specifies the width of the screen in pixels. |
pixelDepth | Specifies the number of bits per pixel in the display. |
colorDepth | Specifies the number of colors possible to display. The number of colors is found using the color palette if one is available, or using the pixel depth. |
None
None