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!

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 Basics Storing and Tracking Information with Variables Creating and Naming Variables Review

mon Wil
mon Wil
2,007 Points

what would the answer be for the quiz of creating a new variable name for [blank shipsLeft = 10 ] thanks

For the quiz on varaible name - JavaScript Basics

1 Answer

Hi, to create a variable you should use one of these keywords- var, let or const. In that quiz, you can choose one of them as an answer.

In general, there are some differences between them. I wrote the main differences for you. Please check this article for more details.

  • var - can be updated and re-declared. Likely to cause a lot of bugs in your code.
  • let - can be updated but not re-declared.
  • const - cannot be updated or re-declared.

So stick with let and const at your project to prevent unexpected errors.

mon Wil
mon Wil
2,007 Points

Ahh okay I was over thinking the question. Trying to come up with a new Variable name haha! All I needed to do was use var. Thanks Busra!