搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
JavaScript
JavaScript 教程
JavaScript基础教程
源代码
清空
点击运行
<!DOCTYPE html> <html> <title>JavaScript typeof运算符示例 - 基础教程(div.cn)</title> <body> <script> const PI = 3.14; var msg = "Hello World"; var city = 'New Delhi'; document.write("Type of PI is: " + typeof PI + "<br>"); document.write("Type of msg is: " + typeof msg + "<br>"); document.write("Type of city is: " + typeof city + "<br>"); </script> <p> <b> typeof运算符返回变量的类型</b> </p> </body> </html>
运行结果