Javascript Array backwards()

Description

Javascript Array backwards()


var words = ["If","only","if","only","the","woodpecker","sighed"];

function listWords(word) {
  console.log(word);//from   ww w .ja va 2 s  .  c o m
}

Array.prototype.backwards = function() {
  words.reverse();
  words.forEach(listWords);
};

words.forEach(listWords);
words.backwards();



PreviousNext

Related