let arrLike = {
'0': 'a',
'1': 'b',
'2': 'c',
length: 3
};
//es5
var arr1 = [].slice.call(arrLike);
console.log(arr1);
//es6
var arr2 = Array.from(arrLike);
console.log(arr2);
console.log(Array.from("hello"));
let nameSet = new Set([1,2]);
console.log(nameSet);
console.log(Array.from(nameSet));
//
Array.from([1,2,3], (n) => {console.log(n)})
//
console.log(Array.of(1,2,3))
//[1, 4, -5, 10].find((n) => n < 0)
//数组实例的entries(),keys()和values()
for(let index of ['a','b'].keys()){
console.log(index);
}
for(let value of ['a','b'].values()){
console.log(value);
}
for(let [index, elem] of ['a','b'].entries()){
console.log(index, elem);
}
//next 遍历
let arrNew = [1,2,3];
let arrList = arrNew.entries();
console.log(arrList.next().value);
console.log(arrList.next().value);
console.log(arrList.next().value);
console.log(arrList.next().value);
console