Why not use other methods, because the following wording takes into account various compatibility.
Determines whether an array
IsArray = function (source) {
Return ' [object Array] ' = = Object.prototype.toString.call (source);
};
Determines whether a Date object
IsDate = function (o) {
return o instanceof Date;
return {}.tostring.call (o) = = = "[Object Date]" && o.tostring ()!== ' Invalid Date ' &&!isnan (o);
};
Determines whether an element object
Iselement = function (source) {
Return!! (Source && source.nodename && Source.nodetype = = 1);
};
Determine if the target parameter is a function or function instance
Isfunction = function (source) {
Under Chrome, ' function ' = = typeof/a/is true.
Return ' [object Function] ' = = Object.prototype.toString.call (source);
};
Determines whether the target parameter is a number type or a number object
Isnumber = function (source) {
Return ' [object number] ' = = Object.prototype.toString.call (source) && isfinite (source);
};
Determines whether the target parameter is an object
IsObject = function (source) {
Return ' function ' = = typeof Source | | !! (Source && ' object ' = = = typeof source);
};
Determines whether the target parameter is a string type or a String object
isstring = function (source) {
Return ' [object String] ' = = Object.prototype.toString.call (source);
};
Determines whether the target parameter is a Boolean object
Isboolean = function (o) {
return typeof o = = = ' Boolean ';
};
JavaScript--To determine whether a data type