Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Objects Loop Through Objects Useful JavaScript Object Methods

Get error with sample code in Firefox's console

I got an error message (Uncaught SyntaxError: redeclaration of const person) when inserting the following code into Firefox's console. The code works fine in Chrome.

const person = {
  name: 'Reggie',
  role: 'Software developer',
  skills: ['JavaScript', 'HTML', 'CSS'],
  isTeacher: true
};

for ( let prop in person ) {
  console.log(prop);
}

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Try removing the let keyword keyword from your working variable.

It could be that Firefox doesn't like that you're trying to do something with the person once it's declared as a constant and then as a let. Constant variable values can't be changed again in a script. Technically the value isn't being changed here but it could be causing that as an issue.