r/learnjavascript • • Oct 26 '20

Javascript string 🔥

193 Upvotes

31 comments sorted by

View all comments

47

u/MrMimmet Oct 26 '20

You should really avoid using 'var' to declare your variables.

21

u/I-DONT-WANT-GOLD Oct 26 '20

Why?

4

u/[deleted] Oct 26 '20

It stimulates browsers' hunger for ram

2

u/I-DONT-WANT-GOLD Oct 26 '20

Wow, that is something I would never have imagined. Thank you!

7

u/mothzilla Oct 26 '20

The reply was nonsense, but most browsers support let and const, and if not (ie you want to support IE6) you can use a code transpiler.

var has subtle scoping issues as pointed out by /u/0xc0ba17.