1.语法:支持JavaScript语法
(1)注释:ctrl+/,双斜杠
(2)声明变量:关键字var声明(eg: var name= "小明")
(3)打印输出:console.log()(eg: console.log(name))
2.数组:
//数组 var array = [1,2,3,4,5,6] console.log(array) // 数组长度 console.log(array.length)
3.字典(对象):
// 字典 var obj = {"name":"xiaoming","age":"32","other":["a","b"]} // 访问方式1 console.log(obj.name,obj.other) // 访问方式2 console.log(obj["name"],obj["other"][1])
4.循环:
var array = [1,2,3,4,5,6] console.log(array) // for循环:循环输出array for (var arr in array){ //in也可以用of console.log() }