代码示例:(标识:eg_js_datatypes_typeof_number)
<!DOCTYPE html>
<html>
<body>

<h2>JavaScript typeof</h2>

<p>typeof 运算符返回变量或表达式的类型:</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = 
typeof 0 + "<br>" + 
typeof 314 + "<br>" +
typeof 3.14 + "<br>" +
typeof (3) + "<br>" +
typeof (3 + 4);
</script>

</body>
</html>
运行结果: