0
New syntax in JavaScript
Why does the JavaScript course show different syntax from the intro to JavaScript course? It gets really confusing
3 ответов
+ 2
Different? in what way if I may ask?
Please come up with more detail in post Description. Which module, chapter etc. for better understanding of post viewers.
0
I mean modules 1 and 2, lesson 4 in the intro to JAVASCRIPT course. It shows the LET keyword for assigning variables instead of the VAR keyword
0
Hello, sorry for a late reply my friend, I didn't notice your reply soon because I'm using SoloLearn web, no notifications :)
Yes, the `let` and `const` specifiers are introduced later on in the course, I'm not sure why, but I'm guessing SoloLearn wanted to make sure that we learners know both the modern syntax and the compatible syntax just for additional knowledge.
`let` assigns data to variable, which maybe altered sometime later on.
`const` assigns data to variable, which should be constant, not alterable nor reassigned new data.
Don't be confused, today's browsers mostly supports new Javascript syntax. Always use the new syntax whenever possible, with the exception where your code must run on older (or very old) browsers which doesn't yet support new syntax.
Keep it up!