Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way to do this is by using an array and a loop. First, create an array containing the four verses in their original order:

var verses = [
  "Verse 1",
  "Verse 2",
  "Verse 3",
  "Verse 4"
];

Then, you can use a for loop to iterate through the array in reverse order and display each verse:

for (var i = verses.length - 1; i >= 0; i--) {
  console.log(verses[i]);
}

This will output:

Verse 4
Verse 3
Verse 2
Verse 1

You can also modify this code to display the verses in reverse order on the webpage by modifying the console.log statement to update the HTML of an element on the page.