<html>
<head>
<script type="text/javascript">
function demoDatetype(){
alert(typeof "I'm string literal");//string
alert(typeof new String("I'm string object"));//object
alert("I'm string" == new String("I'm string"));//true
alert(typeof 123);//number
alert(typeof new Number(98));//object
alert(typeof new Array());//object
alert(typeof new Date());//object
}
</script>
</head>
<body>
<form>
<input type="button" name="demojavascript" value="Demo Datetype"
οnclick="demoDatetype();"/>
</form>
</body>
</html>
[JavaScript] typeof 返回什么值?
最新推荐文章于 2022-03-24 01:01:19 发布