1. let obj = {
    2. start: [1, 2, 3, 4, 5,],
    3. end: [6, 7],
    4. [Symbol.iterator]() {
    5. let idx = 0,
    6. arr = [...this.start, ...this.end],
    7. len = arr.length;
    8. return {
    9. next() {
    10. return idx < len ?
    11. {
    12. value: arr[idx++],
    13. done:false,
    14. }
    15. :
    16. {
    17. value: undefined,
    18. done: true,
    19. }
    20. }
    21. }
    22. }
    23. }
    24. for (let i in obj) {
    25. console.log(i);
    26. }
    27. let arr = [1, 2, 3, 4, 5];
    28. var iter = obj[Symbol.iterator]();
    29. // ...拓展运算符 一定是该对象中存在Symbol.iterator属性
    30. // 数组声明方式
    31. // console.log(new Array()) []
    32. // console.log(new Array(3,1)) [3,1]
    33. // console.log(Array.of(3)); [3]
    34. // console.log(Array.of(3,4,6)); [3,4,6]
    35. // Array.from(likeArray,mapFn,thisArg); 可以将类数组转成数组
    36. // [].slice.call(likeArray);
    37. var oList = document.querySelectorAll('p');
    38. console.log([].slice.call(oList));
    39. console.log(Array.from(oList));
    40. console.log(Array.from(obj));
    41. Array.from(oList, (item, idx) => {
    42. console.log()
    43. console.log(item);
    44. console.log(this.a);// undefined 箭头函数没有this
    45. }, { a: 1 })
    46. // fill|,copyWith,|keys,values,entries|, |includes,find,findIndex|
    47. // fill(val,startIdx(0),endIndx(数组长度))
    48. var arr = [1, 2, 3, 4, 5];
    49. arr.fill(5,)