[Contents]
[Previous] [Next] [Last]This section describes the following new functions and features of functions:
You can nest a function within a function. The nested function can use the arguments and variables of the outer function. The outer function cannot use the arguments and variables of the nested function.
Core function. Converts the specified object to a number.
Number(x)
x
is any object.
When the object is a Date
object, Number
returns a value in
milliseconds measured from 01 January, 1970 UTC (GMT), positive after this date, negative
before.
The following example converts the Date
object to a numerical value:
<SCRIPT LANGUAGE="JavaScript1.2">
d = new Date ("December 17, 1995 03:24:00"); document.write (Number(d) + "<BR>");
</SCRIPT>
This prints "819199440000."
Core function. Converts the specified object to a string.
String(x)
x
is any object.
When the object is a Date
object, String
returns a string
representation of the date. Its format is: Thu Aug 18 04:37:43 Pacific Daylight Time 1983.
The following example converts the Date
object to a readable string.
<SCRIPT LANGUAGE="JavaScript1.2">
D = new Date (430054663215); document.write (String(D) +" <BR>");
</SCRIPT>
This prints "Thu Aug 18 04:37:43 Pacific Daylight Time 1983."
[Contents]
[Previous] [Next] [Last]Last Updated: 10/22/97 11:48:02
Copyright © 1997 Netscape Communications Corporation