js中有哪些数据类型
1、第一:number类型包括整数、浮点数、无穷大let temp=2;let money=5猱蝰逾鸾5.6;conso造婷用痃le.log(typeof temp);console.log(typeof money);
2、第二:string类型识别方法:被“”或者‘’包裹的就是字符串类型let str="cuixiujing";console.log(typeof str);
3、第三:object类型识别方法:用大括号{}定义的变量如何使用里面的属性:用对象名.属性名来使用属性值举例:let person={id:&鳎溻趄酃quot;1",name:"candice",telphone:"12345678903"};console.log(typeof person);
4、第四:array类型识别方法:用中括号[]定义的变量如何使用里面的元素:数组名[2]如:console.log(arr[2]);铛刷故揭举例:let arr=[1,2,3,5,7];console.log(typeof arr);
5、第五:undefined类型识别方法:变量只定义但是没有赋值给变量举例:let a;console.log(typeof a);
6、第六:null类型空指针,不知道以后要进行什么操作时,先定义一个变量let nu=null;console.log(typeof nu);
7、第七:boolean类型true为真,false为假let bool=true;conosle.log(bool);
8、这是最终的结果。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:54
阅读量:86
阅读量:43
阅读量:86
阅读量:69