Home > Web Front-end > JS Tutorial > Examples of using typeof in javascript_javascript skills

Examples of using typeof in javascript_javascript skills

WBOY
Release: 2016-05-16 17:08:11
Original
938 people have browsed it
Copy code The code is as follows:



< ;title>Use of typeof in javascript
<script> <br>//1. Basic type<br>var x = 123; <br>var y = "abc"; <br> var z = true; <br>//alert(typeof x);//number <br>//alert(typeof y);//string <br>//alert(typeof z);//boolean <br> //2. Reference type, the type is object <br>var arr = new Array(); <br>var date = new Date(); <br>var str = new String("abc"); <br>/ /alert(typeof arr);//object <br>//alert(typeof date);//object <br>//alert(typeof str);//object <br>//3. Object type, understandable The simulation of classes in JavaScript is implemented through function <br>alert(typeof Array);//function <br>alert(typeof Date);//function <br>alert(typeof String);//function <br></script>




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