Tell us what’s happening:
I’m starting a bootcamop at the end of the month and am currently doing the pre-course as well as some courses here.
I learned that var is not really common practice any more, but let or const have taken the place…
Your code so far
// Declare myName below this line
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0.
Link to the challenge:
You have the wrong variable name, it shouldn’t be ourName, check it, and you should declare the variable name below that comment line
Thanks. However, what I meant (I asked before I compeltred the excdercise) was that var is not used to declare a variable apparently any more - let should be used or const.
Just wondering why var is used here - maybe for an older version of js?
Great, thanks!!! Much appreciated.
var has problems, and yes,
const are replacements. The issue with JS is that nothing in the language can be deprecated: when a new version of the language comes out (which is, since 2015, every year), all the old stuff has to work in exactly the same way otherwise the internet breaks.
With let and const, it’s harder to make programs that quietly do the wrong thing when there’s an an error, whereas its quite easy to do so using var. As a rule of thumb, use
const for everything until you really need a variable that gets reassigned (eg the counter in a loop).