// 去重复
Array.from(new Set([1, 1, 2, 3])); // [1, 2, 3]
console.log(Array.from(new Set([1, 1, 2, 3]))); // 分解字符串
Array.from('hello'); // ["h", "e", "l", "l", "o"]
console.log(Array.from('hello')); // 转换为ascill
Array.from('hello', x => x.charCodeAt(0)); // [104, 101, 108, 108, 111]
let ascill = Array.from('hello', x => x.charCodeAt(0));
console.log(ascill, typeof (ascill)); // 获取节点
let divs = document.querySelectorAll('div');
Array.from(divs).forEach(function (node) {
console.log(node);
}); // 数组合并
let i = [2, 3, 5, 6];
let j = [1, 2, 3, 4];
let k = Array.of('hello', 666, i, j);
console.log(k);
Array.of('hello'); // ["hello"]
Array.of(1, 2, 3); // [1, 2, 3]
Array.of('blink', 182); // ["blink", 182] // 替换数组内容
// target = 数组位置(3) ,目标等于start数组位置内(0 ~ array.length-1)
let copyWithin1 = [0, 1, 2, 3, 4].copyWithin(target = 3, start = 0);
console.log('copyWithin1:', copyWithin1); // target = 数组位置(3) ,目标等于start数组位置内(0 ~ array.length-1),结束位置是4
let copyWithin2 = [0, 1, 2, 3, 4].copyWithin(target = 0, start = 3, end = 4); // [3, 1, 2, 3, 4]
console.log('copyWithin2:', copyWithin2); // fill - 填充
[0, 1, 2, 3, 4].fill(5); // [5, 5, 5, 5, 5]
// 第二个以后开始fill填充
[0, 1, 2, 3, 4].fill(5, start = 2); // [0, 1, 5, 5, 5]
// 第二个开始填充,下标4结束.
[0, 1, 2, 3, 4].fill(5, start = 2, end = 4); // [0, 1, 5, 5, 4] // 字符串包含 - es6
function startsWithLetterA(e, index, array) {
// 包含开头内容a - es6 字符串搜索
console.log(e, index, array);
if (e.startsWith('a')) {
return e;
}
}
var cuteNames = ['jeff', 'marc', 'addy', 'francois'];
cuteNames.find(startsWithLetterA); // "addy" // 字符串包含 - 返回下标
function startsWithLetterA(element, index, array) {
if (element.startsWith('a')) {
return element;
}
}
var cuteNames = ['jeff', 'marc', 'addy', 'francois']; cuteNames.findIndex(startsWithLetterA); //
END...

es6 - array for-chrome的更多相关文章

  1. vue.js 进行初始化遇到的关于core-js的错误@core-js/modules/es6.array.find-index]

    D:\vuejselement\workSpace\zutnlp_platform_show>cnpm install --save core-js/modules/es6.array.find ...

  2. es5||es6 - array

    导航目录 /** * javascript - array * * ES5: * join() * push() * pop() * shift() * unshift() * sort() * re ...

  3. es6 Array.from + new Set 去重复

    // es6 set数据结构 生成一个数据集 里面的元素是唯一的 const items = new Set([1, 2, 3, 4, 5, 5, 5, 5]); // items 是个对象 item ...

  4. 解决低版本chrome浏览器不支持es6 Array.find()

     if (!Array.prototype.find) {  Array.prototype.find = function(predicate) {    'use strict';    if ( ...

  5. IE 浏览器不支持 ES6 Array.from(new Set( )) SCRIPT438: 对象不支持“from”属性

    [转]解决老浏览器不支持ES6的方法 现象: Array.from(new Set( )) SCRIPT438: 对象不支持“from”属性或方法   解决方法: 安装babel 引入browser. ...

  6. [ES6] Array.findIndex()

    In es5, you can use indexOf to get the index of one item in an array. In es6, you can use findIndex( ...

  7. [ES6] Array.find()

    Convenient method to find one item in an array, avoid writing and  for + if: let arys = [1,,5,,6] ; ...

  8. [ES6] Array -- Destructuring and Rest Parameters && for ..of && Arrat.find()

    We can use the destructing and rest parameters at the same time when dealing with Array opration. Ex ...

  9. es6 Array数组方法

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

随机推荐

  1. JAVA下几个问题

    一.Server MyEclipse Tomcat v8.5 was unable to start within 45 seconds. If the server requires more ti ...

  2. Quartus 调试中的Nios 程序

    FPGA的程序通常包含硬件和软件两部分.正常情况下调试需要分别进行下载,过程繁琐. 为了将Nios II的软件程序包含到.sof文件中方便调试,可以在SOPC Builder中的RAM初始化为Nios ...

  3. PHP高性能开发-多进程开发

    硬件多核时代的软件业以前计算能力的提升一直在摩尔定律的指引下,沿着提升CPU时钟频率这条道路前进,从初期的几十MHz到如今的几GHz.但是,进入2002年以 来,CPU提升主频的困难越来越大,因为主频 ...

  4. Inline Hook

    @author: dlive IAT Hook时如果要钩取的API不在IAT中(LoadLibrary后调用),则无法使用该技术.而Inline Hook不存在这个限制. 0x01 Inline Ho ...

  5. C语言中的“>>”和“<<”

    http://baike.1688.com/doc/view-d1750791.html C语言中的“>>”和“<<” [标签:程序设计] 浏览次数:68937提问时间:200 ...

  6. 数据库--MyBatis的(insert,update,delete)三种批量操作

    转自:http://blog.csdn.net/starywx/article/details/23268465 前段时间由于项目赶期没顾上开发过程中的性能问题,现对部分代码进行优化的过程中发现在数据 ...

  7. HDU5469 Antonidas(树分治&&哈希)

    给你一颗点上有字符的树,问一个给定的字符串是否是这棵树上的两点的路径. 树分治的思想就是每次找重心,重心下的子问题分解去做,然后就是合并了.合并的时候用一个总的set<pair<len,h ...

  8. Appium+python自动化9-SDK Manager【转载】

    前言 SDK Manager到有哪些东西是必须安装的呢? 一.SDK Manager 1.双击打开SDK Manager界面

  9. hdu 5104(数学)

    Primes Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  10. (15)C#集合

    http://blog.csdn.net/hcw_peter/article/details/3980723 集合分为非泛型集合和泛型集合 ,泛型集合可以指定放入集合中的类型. 一.非泛性集合 引用命 ...