typeof

作者: 没有昵_称 | 来源:发表于2020-04-08 15:55 被阅读0次

typeof

语法:typeof(表达式)和typeof xxx

值:undefined object boolean number string function symbol bigint

栗子:

typeof NaN  //number
typeof Infinity //number
typeof Math.LN2 //number

typeof typeof(1) //string
typeof 42n //bigint
typeof Boolean(1)  //boolean
typeof !!1 // boolean

typeof Symbol() //symbol
typeof Symbol.iterator //symbol

typeof undefined // 'undefined';
typeof abc //'undefined';

typeof {} //object
typeof [] //object
typeof /d/ //object
typeod null //object

typeof new Boolean(true)  //object
typeof new Number(1) //object
typeof new String('abc') //object

typeof function() {} //function
typeof class C {} //function
typeof Math.sin //function

typeof Math.sin() //number

相关文章

网友评论

      本文标题:typeof

      本文链接:https://www.haomeiwen.com/subject/jxqkzftx.html