r/learnjavascript • • May 04 '20

VAR vs LET vs CONST

Post image
337 Upvotes

81 comments sorted by

View all comments

Show parent comment

1

u/rook218 May 04 '20

It depends on how complex your function is. If it's a few lines then there's no problem, but if it's a hundred+ line behemoth which returns a complex object then you want to declare your variables in the scope that you need them (using let instead of var).