首页 > 编程语言 > 详细

JavaScript数据类型

时间:2016-02-01 22:30:21      阅读:196      评论:0      收藏:0      [点我收藏+]
VariableExplanationExample
String A string of text. To signify that the variable is a string, you should enclose it in quote marks. var myVariable = ‘Bob‘;
Number A number. Numbers don‘t have quotes around them. var myVariable = 10;
Boolean A True/False value. The words true and false are special keywords in JS, and don‘t need quotes. var myVariable = true;
Array A structure that allows you to store multiple values in one single reference. var myVariable = [1,‘Bob‘,‘Steve‘,10];     Refer to each member of the array like this: myVariable[0], myVariable[1], etc.
Object Basically, anything. Everything in JavaScript is an object, and can be stored in a variable. Keep this in mind as you learn. var myVariable = document.querySelector(‘h1‘);     All of the above examples too

 

总结:

JavaScript共有五种数据类型:

字符串

数字

布尔类型

数组

对象       (javascript中的所有东西都是一个对象)

 

JavaScript数据类型

原文:http://www.cnblogs.com/beenupper/p/5176361.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!