var numbers = [1, 2, 3, 4, 5]; numbers.reverse(); console.log(numbers); var numbers = [1, 10, 2, 11, 3]; numbers.sort(); numbers.sort(function(a, b) { returnt a - b; }); var names = ['ab', 'Casron', 'Ac', 'she']; names.sort(); names.sort(function(a, b) { if (a.toLowerCase() < b.toLowerCase()) { return -1; } if (a.toLowerCase() > b.toLowerCase()) { return 1; } return 0; }); var numbers = [ 0, 1, 2, 22, 5 ]; numbers.indexOf(5); numbers.splice(2, 0 , 5); numbers.indexOf(5); numbers.lastIndexOf(5); numbers.lastIndexOf(8);
|