
1、typeof操作符返回字符串,表示未计算操作数的类型。
2、typeof一般用来检验简单的数据类型,返回的基本类型用字符串表示,而复杂的数据类型中function返回的是Function,其他的都返回Object,其中null特殊,表示一个空对象。
实例
typeof1//'number'
typeof'1'//'string'
typeofundefined//'undefined'
typeoftrue//'boolean'
typeofSymbol()//'symbol'
typeofnull//'object'
typeof[]//'object'
typeof{}//'object'
typeofconsole//'object'
typeoffunction(){}//'function'原文来自:https://www.py.cn © 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END



















































暂无评论内容