美文网首页
无标题文章

无标题文章

作者: 凸小布 | 来源:发表于2017-02-21 19:12 被阅读11次

基本数据类型(简单数据类型)

  • string 字符串类型
  • number 数值(小数和整数)
  • null 空
  • undefined 未定义
  • boolean 布尔类型(true | false)

复杂数据类型(混合数据类型)

  • Object 对象类型
  • Array 数组类型
  • Date 日期类型
  • Boolean 布尔类型
  • String 字符串对象类型
  • Function 函数
  • RegExp 正则表达式
  • Number
  • Math

如何判断数据的数据类型

  • 关键字:typeof

  • 语法:typeof 变量

  • 结论:复杂数据在使用typeof操作的时候,打印出来的结果都是object ,除了函数
    console.log(typeof function(){}); //function

  • null注意点

console.log(typeof null); //object
console.log(null instanceof Object); //false

typeof的返回值是什么类型 --- string类型

<script>
    var a = 'wyq';
    var b = 10;
    var c = true;
    var d = undefined;
    var e = null;

    console.log(typeof a); //string
    console.log(typeof b); //number
    console.log(typeof c); //boolean
    console.log(typeof d); //undefined
    console.log(typeof e); //object

    console.log(typeof null); //object
    console.log(null instanceof Object); //false

    console.log(typeof function(){}); //function

    console.log(typeof undefined); //undefined
</script>

相关文章

  • 无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章 无标题文章无标题文章无标题文章无...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • fasfsdfdf

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章 无标题文章 无标题文章无标题文章 无标题文章 无标题文章

网友评论

      本文标题:无标题文章

      本文链接:https://www.haomeiwen.com/subject/vpiuwttx.html