< Html Xmlns = "Http://www.w3.org/1999/xhtml" >
< Head >
< Title > </ Title >
< Script Type = "Text/JavaScript" >
Function Show (){
// If typeof is followed by a parameter, a string of the parameter type is returned.
VaR I = 5.5 ; // Number
VaR J = " ABC " ; // String
VaR B = True ; // Boolean
VaR Io = New Number ( " 5.5 " ); // Object
VaR Jo = New String ( " ABC " ); // Object
VaR Bo = New Boolean ( 0 ); // Object
VaR Bo1 = Boolean ( 0 );
Alert ( Typeof Bo1 ); // Boolean
// Alert (typeof alert); // All function types are Function
// Alert (typeof K); // The types of undefined values (or understood as nonexistent) are all undefined.
/*
special values
alert (typeof (NAN )); // number
alert (typeof (infinity); // number
alert (typeof null); // object
*/
}
// Boolean object
// Syntax for creating a Boolean object:
/* New Boolean (value); // Constructor
Boolean (value); // Conversion Function
Parameters:
Value is the value stored by a Boolean object or the value to be converted to a Boolean value.
Return Value:
When called as a constructor (with the new operator), Boolean () converts its parameters into a Boolean value and returns a Boolean object containing the value.
When called as a function (without the new operator), Boolean () only converts its parameters into an original Boolean value and returns this value.
Note: If the value parameter is omitted or set to 0,-0, null, "", false, undefined, Or Nan, the object is set to false. Otherwise, set it to true (even if the value parameter is a string "false ").
*/
</ Script >
</ Head >
< Body >
< Input Type = "Button" Value = "Click me" Onclick = "Show ()" />
</ Body >
</ Html >