< ;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>