js中的typeof 操作符

使用postman进行接口测试,其中验证字段的类型用到了typeof 

//验证类型
tests["Code type is number"] = typeof(responseJson.Code) === "number";
tests["Items type is object"] = typeof(responseJson.Items) === "object";

typeof 操作符用来检测给定的变量的数据类型,
对一个值使用typeof操作符可能返回下列某个字符串:

"undefined" : 如果这个值没有定义;
"boolean" : 如果这个值是布尔值;
"string" : 如果这个值是字符串;
"number" : 如果这个值是数值;
"object" : 如果这个值是对象或null;
"function" : 如果这个值是函数;

原文地址:https://www.cnblogs.com/ronyjay/p/6231936.html