writeln("Value: " + obj + " | Type: "+
Object.getType(obj)+ " | Type Name: " +
Object.getTypeName(obj));
document.writeln("
");
CHAPTER 4 ?– ASP.NET AJAX CLIENT LIBRARIES 63
}
DisplayTypeInfo(num);
DisplayTypeInfo(date);
In this script, two variables of type Number and Date are instantiated and assigned initial
values. After that, the DisplayTypeInfo function is called to display the type
information for these two variables. The getType method is called here for the type of the
variable followed by the getTypeName to get the name of the variable type. As you can see
in Figure 4-5, the type contains more information than the type name.
Figure 4-5. Displaying type and type names of two variables
String Extension
Last but not least, the JavaScript??™s native String object has been extended in the xyz to
include a handful of useful additions to once again make it somewhat more similar to the
String class in the .NET Framework. These additions can be very useful because string
processing in one form or another is done quite often in most applications.
Pages:
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123