zoukankan      html  css  js  c++  java
  • es6需要懂的技术

    1、js内置对象 

    对象中的扩展运算符(...)用于取出参数对象中的所有可遍历属性,拷贝到当前对象之中
    //Object.assign({}, bar)

    //去重——数组-对象-数组
    Array.from(new Set([1,2,3,2]))
    [...new Set([1,2,3,2])]


    //并集
    var a = new Set([1, 2, 3]);
    var b = new Set([4, 3, 2]);
    var union = new Set([...a, ...b]); // {1, 2, 3, 4}


    //交集
    var a = new Set([1, 2, 3]);
    var b = new Set([4, 3, 2]);
    var intersect = new Set([...a].filter(x => b.has(x))); // {2, 3}


    //差集
    var a = new Set([1, 2, 3]);
    var b = new Set([4, 3, 2]);
    var difference = new Set([...a].filter(x => !b.has(x))); // {1}


    //对象解构赋值
    var { name, age, id } = { id: "007", name: "Conan", age: 28 };
    var { name: person_name, age: person_age, id: person_id } = { id: "007", name: "Conan", age: 28 };

  • 相关阅读:
    RedissonConfProperty
    IdGenerator(雪花)
    Btrace和arthas地址
    SqlFilter
    AuthorityFilter
    111
    分布式数据库-杂记
    站点集群
    分布式精华文章
    高并发
  • 原文地址:https://www.cnblogs.com/zoushuangyu/p/13597727.html
Copyright © 2011-2022 走看看