1-1 基本数据类型number,string,boolean,undefined,null

判断数组:

  1. let arr = []
  2. 1. instanceof
  3. arr instanceof Array
  4. 2. __proto__
  5. arr.__proto__ === Array.prototype
  6. 3. constructor
  7. arr.constructor === Array
  8. 4. Object.prototype.toString
  9. Object.prototype.toString.call(arr) === '[object Array]'
  10. 5. Array.isArray
  11. Array.isArray(arr)

1-2 引用数据类型 Array,Function,Object

  1. var arr = [1,2,3];
  2. function go(){
  3. console.log("hello world")
  4. }
  5. go();
  6. var obj ={
  7. name:"zhang",
  8. age:18
  9. }
  10. console.log(obj.name); //读取对象的某个属性

1-5 数组的方法 push,unshift,forEach

  1. let arr = ["html","css"];
  2. // 1.push 向数组的后面添加
  3. arr.push("js")
  4. console.log(arr);
  5. // 2.unshift 向数组的前面添加值
  6. arr.unshift("vue");
  7. console.log(arr);
  8. //3.forEach
  9. let arr = ["html","css","js"];
  10. // forEach遍历
  11. arr.forEach(function(item){
  12. console.log(item)
  13. })