let vs. var
let will hijack implicitly whatever block it appears in.
If you define a variable in the for loop using var, that variable will be available within the function, but if you define it using the let key word, it will be available within the for block only.
** I took these snapshots from Kyle Simpson workshop called "Advanced JavaScript"
No comments:
Post a Comment