+ 10

Are Const and lets no longer needed in JavaScript 🤔🤔😕😕??

Now look at this code https://code.sololearn.com/WrPe4P8H9s91/?ref=app I tried it on browser as well and it worked fine🙁... But why?? 👀 And is this the end of using 'const's and 'let's 😐 just like python🤔?? What you guys think of it?? 🤔🙃

24th Nov 2020, 3:03 AM
Shreyansh
Shreyansh - avatar
5 Antworten
+ 9
Not the case, it seems you misunderstood it. If you don't use declaration keywords then it will make that variable global scoped variable(not recommended at all) https://code.sololearn.com/WWFa8Sti92Sn/?ref=app
24th Nov 2020, 3:31 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 6
Steve Sajeev thanks for suggestion I added the open ended tag ( I've seen mods doing so😅😅)
24th Nov 2020, 3:14 AM
Shreyansh
Shreyansh - avatar
+ 4
Var let and const are used to define variables. What you are using are undefined variables. The problem with that is if you make a typo, there will be a whole new variable in the code to deal with... https://code.sololearn.com/WfIjWr5gEzOQ/?ref=app
24th Nov 2020, 3:31 AM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar
+ 2
Ok Raj Chhatrala , sorry...
24th Nov 2020, 4:26 AM
Steve Sajeev
Steve Sajeev - avatar
+ 2
Java script has so much options so much possibilities that's why I love it😃 I declare a variable like this most of the time👇 name="atomic wave"
25th Nov 2020, 12:26 AM
Atoms~⚛
Atoms~⚛ - avatar