Note:
Some time ago, when I got familiar with ASP VBScript, I switched to Javascript/Jscript, mainly to Jscript.
However, there is basically no difference between the two. The only difference is that Jscript has no client concept.
At the beginning, I found that many of the practical functions Js in VBS were not available, such as formatNumber, isArray, and isDate.
The date object is also very strange, and cannot be directly added or subtracted. set ***...
However, when you have mastered Javascript/Jscript to a certain extent, you will find that it is N times better than VBS. What is strong is that it has free syntax, and VBS does not have a certain function, in JavaScript, you only need to create prototype or a judgment function to implement the same function. the other obvious difference is that regular expressions are available everywhere.
Ah, a bunch of nonsense. Come on.
Directory:
1. Determine whether it is an array type.
2. Determine whether the string type is used.
3. Determine whether the data type is Numeric.
4. Determine if it is of the date type
5. determine whether it is a function.
6. Determine whether the object is used
Shawl. qiu
2006-11-13
Http://blog.csdn.net/btbtd
1. Determine whether it is an array type.
Linenum
<Script type = "text/javascript">
// <! [CDATA [
Var a = [0];
Document. write (isArray (a), '<br/> ');
Function isArray (obj ){
Return (typeof obj = 'object') & obj. constructor = Array;
}
//]>
</Script>
2. Determine whether the string type is used.
Linenum
<Script type = "text/javascript">
// <! [CDATA [
Document. write (isString ('test'), '<br/> ');
Document. write (isString (10), '<br/> ');
Function isString (str ){
Return (typeof str = 'string') & str. constructor = string;
}
//]>
</Script>
3. Determine whether the data type is Numeric.
Linenum
<Script type = "text/javascript">
// <! [CDATA [
Document. write (isNumber ('test'), '<br/> ');
Document. write (isNumber (10), '<br/> ');
Function isNumber (obj ){
Return (typeof obj = 'number') & obj. constructor = number;
}
//]>
</Script>
4. Determine if it is of the date type
Linenum
<Script type = "text/javascript">
// <! [CDATA [
Document. write (isDate (new Date (), '<br/> ');
Document. write (isDate (10), '<br/> ');
Function isDate (obj ){
Return (typeof obj = 'object') & obj. constructor = Date;
}
//]>
</Script>
5. determine whether it is a function.
Linenum
<Script type = "text/javascript">
// <! [CDATA [
Document. write (isFunction (function test () {}), '<br/> ');
Document. write (isFunction (10), '<br/> ');
Function isFunction (obj ){
Return (typeof obj = 'function') & obj. constructor = function;
}
//]>
</Script>
6. Determine whether the object is used
<Script type = "text/javascript">
Linenum
// <! [CDATA [
Document. write (isObject (new Object (), '<br/> ');
Document. write (isObject (10), '<br/> ');
Function isObject (obj ){
Return (typeof obj = 'object') & obj. constructor = object;
}
//]>
</Script>