Array instances
Conteúdo completo sobre Arrays
The
Código
var array1 = ['one', 'two', 'three'];
var reversed = array1.reverse();
console.log(array1);
// expected output: Array ['three', 'two', 'one']
console.log(reversed);
// expected output: Array ['three', 'two', 'one']
The
reverse() method reverses an array in place. The first array element becomes the last, and the last array element becomes the first.Código
var array1 = ['one', 'two', 'three'];
var reversed = array1.reverse();
console.log(array1);
// expected output: Array ['three', 'two', 'one']
console.log(reversed);
// expected output: Array ['three', 'two', 'one']
Comentários
Postar um comentário