Aim of the puzzle: Use the .reverse()
array method to reverse the order of elements in an array.
Walk through of solution: When the puzzle loads, the word
array contains the strings ['S','T','R','E','S','S','E','D']
.
To complete the puzzle, use the .reverse()
method to reverse the order of this array, by adding .reverse()
to the end of word
. When the code runs, ['S','T','R','E','S','S','E','D']
will become ['D', 'E', 'S', 'S', 'E', 'R', 'T', 'S']
.
Sample code solution:
let word = ['S','T','R','E','S','S','E','D'];
word.reverse();
console.log(word);
Javascript Concepts: Arrays, Array Methods, .reverse()
, console.log