js typeof

引子:

  python type(variable)

一、js中的type 类型

  JS中的变量是松散类型(即弱类型)的,可以用来保存任何类型的数据。

  typeof 可以用来检测给定变量的数据类型,可能的返回值:

  1. 'undefined' --- 这个值未定义;

  2. 'boolean'    --- 这个值是布尔值;

  3. 'string'        --- 这个值是字符串;

  4. 'number'     --- 这个值是数值;

  5. 'object'       --- 这个值是对象或null;

  6. 'function'    --- 这个值是函数。  

percentText = "43.16%"
typeof percentText
// "string"
typeof(percentText)
// "string"

二、其他

--------------------2016-8-4 17:46:56--

    source:【1】 js中typeOf用法

原文地址:https://www.cnblogs.com/mxh1099/p/5737683.html