源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <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>
运行结果