Hello! I am supposed to “print the number and title for each value in titles
. Make sure that the first in the list is 1
, not 0
.”
- The Philosopher’s Stone
- The Chamber of Secrets
- The Prisoner of Azkaban
// and so on…
I know how to loop through the array, but unsure how to “number” the list. Thanks in advance!
titles = ['The Philosopher\'s Stone', 'The Chamber of Secrets', 'The Prisoner of Azkaban', 'The Goblet of Fire', 'The Order of the Phoenix', 'The Half-Blood Prince', 'The Deathly Hallows'];
for (let i=0; i<=6; i++) {
console.log(titles[i]);
}