Skip to content

Using var, const, and let in JavaScript

Updated: at 04:33 PM

When? var => never. const => for objects and arrays. let => for primitives

Remy Sharp writes:

As I slowly make my way into the land of ES6 (sure I started mid-2016 when all the cool kids were doing it for years) I’ve been presented with the problem of: when do you use const and when do you use let and do I still use var.

Read more from the source: