var arr1 = [1,2,3];
var arr2 = [...arr1];
console.log(arr2); //[1,2,3]
var a = [1,2,3];
var b = [4,5,6];
var c = [6,7,8];
// ES5
var d = a.concat(b,c);
console.log(d);
// ES6
var e = [...a,...b,...c];
console.log(e);
let[a,b,...args]=[1,2,3,4,5];
console.log(a); //1
console.log(b); //2
console.log(args); //[3,4,5]
let arr = [..."hello"]
console.log(arr) //["h", "e", "l", "l", "o", "w"]
1.Array.from()
1.find()
let arr = [9,16,-9,7,56];
var result = arr.find(function(item,index){
if(item>10){
return true;
}
return false;
})
console.log(result);
2.findIndex()
let arr = [9,16,-9,7,56];
for(let[key,value]of arr.entries()){
console.log(key,value)
}