front

  1. 箭头函数(匿名函数)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    var s = function (pp){
    return "function"
    }
    // 替换成现在这样
    (pp)=>{return "function"}
    // 可以简写为下面这样(“()”, 当参数为一个时,可省略, “{}”, 当语句为一条时, return 也可省略)
    pp => "myfunction" + pp
    // 假如需要返回一个对象
    (pp)=>({"name": "function"})
    // 能够对this 进行
  2. 循环

    1. for (var i in arr){} // i 为 索引/键
    2. for (var i of arr){} // i 为 值,arr 不可为对象
    3. for (var i;i<10;i++){}
    4. while (i > 10){}
    5. do {}while(){} // 循环之前先执行 do 里面的语句(不常用)
  3. 遍历数组

    1. forEach((index, item, items)=>{}, thisValue);
    2. arr.map((index, item, items)=>{}, thisValue);
  4. 新增数据类型(Map, Set)