javascript数据类型检测typeof

来源:互联网 发布:opencv tld算法 编辑:程序博客网 时间:2024/05/12 13:39
typeof 10;//’number’typeof “hello”;//”string”typeof undefined;//”undefined”typeof true;//”boolean”typeof function(){} //”function”typeof {};//”object”typeof null;//”object”typeof [1,2,5]//”object”typeof /[abc]/; ‘object’;typeof可以用来检测数字、字符串、布尔、函数、undefined如果用来检测数组、null、object类型、正则就显得无能为力了

0 0