Javascript basic tutorial typeof operator
typeof operator
typeof is used to detect the data type of variables. The following characters will be returned for values and variables
Undefined
In JavaScript, undefined is a variable that has no set value.
typeof A variable with no value will return undefined.
Let’s write an example below:
检测数据类型
The above code will output undiffed
Boolean type
The following example:
检测数据类型
string type
检测数据类型
number type
检测数据类型
Object
检测数据类型
Note: An empty object means that the object has been created, but there is no content in it
NULL empty
检测数据类型
function function
检测数据类型
Note: box is a function function. The return value is function box(){}. The returned character channeling type is function