JavaScript: var vs let vs const

Nice Doodle by Abhishek Kumar explaining the difference between JavaScript’s var, let, and const:

Good to see hoisting is also explicitly mentioned by name.

💁‍♂️ I personally always start with const. Only if I need to reassign a variable’s value (for example: a counter in a loop) I use let. I see no good reason to use var.

Published by Bramus!

Bramus is a Freelance Web Developer from Belgium. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.