So I'm working through your book with my nephew. When I learned coding (a looooooooong time ago), I would get an error when I used "let" to define the same thing. I started the book a few months ago, and did everything so that when I went through it with my nephew, I'd be good to go. Cue, Covid, so he has lots of free time and we finally got around to working through it together, me as his teacher, religiously reading the book, and him, on Google Meet, following along and doing the exercises.
So a few months ago, I still got an error when I used "let" to define something, now I don't.... now he doesn't ... in fact, we can define things without using let or var or const being in front of it. What gives? Is the undeclared definition a var? a const? let?
Any advice? I basically told him to keep good form, and declare only once, but I'm not sure if that's just me being a purist or if it will later affect stuff.
let & var
-
- Site Admin
- Posts:20
- Joined:Mon May 14, 2018 10:19 pm
- Location:Kansas
- Contact:
Re: let & var
Great question, Audiferus!
Go ahead and be a purist! declare with `let` the first time and then don't use `let` again if you reassign it. Chrome used to throw an error if you used `let` a 2nd time, but it's more forgiving now. Still, the correct practice is to use it only the first time.
`var` is the loosest of the three, which is why it is avoided my modern javascript developers. Best to understand it if you see it but try not to ever write it yourself.
Happy coding!
Go ahead and be a purist! declare with `let` the first time and then don't use `let` again if you reassign it. Chrome used to throw an error if you used `let` a 2nd time, but it's more forgiving now. Still, the correct practice is to use it only the first time.
`var` is the loosest of the three, which is why it is avoided my modern javascript developers. Best to understand it if you see it but try not to ever write it yourself.
Happy coding!
- Williamnen
- Posts:8
- Joined:Mon Nov 22, 2021 12:27 pm
- Location:United States
- Contact:
-
Sorry I didnt come back to this post sooner, I tried editing in the later posts, and that worked.. but the 1st post still wont let me edit it.. weird puter gremlin stuff..
.
.
Супер важные news
Супер шокирующие news на новостном портале xnews press . Самое из самых изданий
-
- Posts:42
- Joined:Thu Dec 30, 2021 7:53 pm
- Location:http://product-of-china.cf/
- Contact:
-
Its certain characters in the fonts, most can be fixed in the Apple stuff that benbaboon found, not researching which ones it is for everyone else.