javascrip基础
1-1 基本数据类型number,string,boolean
var a = 10;var str = "hello world";var b = true;
1-2 引用数据类型 Array,Function,Object
var arr = [1,2,3];function go(){console.log("hello world")}go();var obj ={name:"zhang",age:18}console.log(obj.name); //读取对象的某个属性
1-3 控制语句
//forfor(var i=0;i<=3;i++){console.log(i);}//if-elsevar age = 17;if(age>=18){console.log("去网吧")}else{console.log("家里蹲")}
1-4 逻辑判断
//逻辑与 && 只有两边为true,结果才为true// 逻辑或 || 只要有有一边为true,结果为true//逻辑非 ! 取反console.log(10>3 && 10>7)console.log(10>3 && 10>11)console.log(10>12 || 10>3)console.log(!(10>12))
1-5 数组的方法 push,unshift,forEach
let arr = ["html","css"];// 1.push 向数组的后面添加arr.push("js")console.log(arr);// 2.unshift 向数组的前面添加值arr.unshift("vue");console.log(arr);//3.forEachlet arr = ["html","css","js"];// forEach遍历arr.forEach(function(item){console.log(item)})
**
