Array instances

Conteúdo completo sobre Arrays


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

Postagens mais visitadas deste blog

Quiz Verificando seu saldo

Quiz: Morrendo de rir 1 (5-1)