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
| arr1.push(4); arr1.pop(); arr1.unshift('11'); arr1.shift(); var arr2 = [2, 4, 5]; var arr = arr1.concat(arr2); var arr = arr1.join('-'); var str = '2013-3-21' var arr = str.split('-'); var arr = [1, 2, 3, 4, 5, 6, 7, 8]
arr.splice(3, 3);
arr.splice(3, 0, 'a', 'b'); alert(arr);
arr.splice(3, 2, 'a', 'b'); var arr = [12, 33, 456, 336, 778, 234, 99, 53];
arr.sort(function(num1, num2) { return num1 - num2; });
arr.reverse();
|