js 判断变量类型

193 阅读1分钟
  • 1. typeof ''

    //"string"
  • 2. '' instanceof String

    // false
  • 3. Object.prototype.toString.call('') 推荐

    //"[object String]"