Home > Web Front-end > JS Tutorial > js determines the data type, such as determining whether it is an array, whether it is a string, etc. _javascript skills

js determines the data type, such as determining whether it is an array, whether it is a string, etc. _javascript skills

WBOY
Release: 2016-05-16 17:03:37
Original
1450 people have browsed it

1 Determine whether it is an array type
2 Determine whether it is a string type
3 Determine whether it is a numeric type
4 Determine whether it is a date type
5 Determine whether it is a function
6 Determine whether it is an object

1 Determine whether it is an array type

Copy code The code is as follows:



2 Determine whether it is a string type
Copy code The code is as follows:



3 Determine whether it is a numeric type
Copy code The code is as follows:



4 Determine whether it is a date type
Copy the code The code is as follows:



5 Determine whether it is a function
Copy code The code is as follows:



6 Determine whether it is an object
Copy code The code is as follows:

< ;script type="text/javascript">
//document.write(isObject(new Object()),'
');
document.write(isObject(10),'
');
function isObject(obj){
return (typeof obj=='object')&&obj.constructor==Object;
}
//]]>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template