1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
| var arr = [1, 2, 3]; var result = arr.push(4);
var arr = [1, 2, 3]; var result = arr.pop();
var arr = [1, 2]; arr.length;
var arr = [1, 2, 3]; var result = arr.unshift(0);
var arr = [1, 2, 3]; var result = arr.shift();
var arr = [1, 2, 3, 4, 5]; var result01 = arr.splice(2, 1, 6); var arr = [1, 2, 3, 4, 5]; var result02 = arr.splice(2, 0, 6);
var arr = [1, 2, 3, 4, 5]; var result03 = arr.splice(2, 0, 6, 7, 8)
var arr = [1, 2, 3, 4, 5]; var result01 = arr.slice(1, 3); var arr = [1, 2, 3, 4, 5]; var result02 = arr.slice(-2); var arr = [1, 2, 3, 4, 5]; var result03 = arr.slice(-2, 0); var arr = [1, 2, 3, 4, 5]; var result04 = arr.slice(0);
var arr = [1, 2, 3, 4, 5]; var result01 = arr.indexOf(3); var arr = ['a', 'ab', 'abc', 'abcd']; var result02 = arr.indexOf('a'); var result03 = arr.indexOf('b'); var result04 = arr.indexOf('ab');
var arr = [1, 2, 3, 2, 1]; var result01 = arr.lastIndexOf(1); var arr = ['a', 'ab', 'abc', 'ab', 'a']; var result02 = arr.lastIndexOf('a'); var result03 = arr.lastIndexOf('b'); var result04 = arr.lastIndexOf('ab');
var arr = [1, 2, 3, 4, 5]; var result01 = arr.some(function (element, index, array) { return element > 3 }); var result02 = arr.some(element => element > 5);
var arr = [1, 2, 3, 4, 5]; var result01 = arr.every(function (element, index, array) { return element > 3 }); var result02 = arr.every(element => element < 6);
var arr = [1, 2, 3, 4, 5]; var result = arr.join(',');
var arr = [5, 4, 3, 2, 1]; var result = arr.sort(); var arr = ['c', 'b', 'a', 0]; var result = arr.sort();
var arr = [1, 2, 3, 4, 5]; var result = arr.reverse(); var arr = [0, 'a', 'b', 'c']; var result = arr.reverse();
var a = [1, 2]; var b = [3, 4]; var c = a.concat(b); var d = [...a, ...b]; var e = a.concat(0, [3, 4]);
var arr = [1, 2, 3, 4, 5]; arr.forEach(function (element, index, array) { console.log(element, index, array); });
var arr = [1, 2, 3, 4, 5]; var result01 = arr.map(function (element) { return element + 10; }); var arr = [1, 4, 9]; var result02 = arr.map(Math.sqrt);
var arr = [1, 2, 3]; var result = arr.filter(function (element) { return element > 2; });
var arr = [1, 2, 3, 4, 5]; var result = arr.reduce(function (previous, current, currentIndex, array) { return previous + current; }, 100);
var arr = ['ab', 'bc', 'de']; var result = arr.reduceRight(function (pre, cur, index, arr) { return pre + cur; }, 'I am initial:');
var a; var b = a += 2;
var a = null; var b = a += 2;
|