JavaScript JavaScript Arrays Loop Through Arrays Array Methods

Alonzo Delk
Alonzo Delk
6,536 Points

I could use some help because I'm unsure as to why my code isn't working?

script.js
const planets = ['Earth','Mars','Saturn','Mercury','Jupiter','Venus','Uranus','Neptune'];
console.log(planets.indexOf('Saturn'));

2 Answers

Cameron Childres
MOD
Cameron Childres
Treehouse Moderator 11,695 Points

Hi Alonzo,

I think the issue is that you've removed the answer to the first part of the challenge. Put back the answer to step 1 and you should be able to pass:

const planets = ['Earth','Mars','Saturn','Mercury','Jupiter','Venus','Uranus','Neptune'];
console.log(planets.join(', '));
console.log(planets.indexOf('Saturn'));
Alonzo Delk
Alonzo Delk
6,536 Points

Hey Cameron I appreciate you for that. Safe code