var is function-scoped, while let and const are block-scoped. const also stops the variable from being reassigned.
var can be redeclared and updated. It is hoisted and starts as undefined, so reading it before its line gives undefined instead of an error.
let can be updated but not redeclared in the same scope. It is hoisted but not initialized, so reading it before its declaration throws a ReferenceError.
const can be neither updated nor redeclared, and it must be initialized where it is declared. It fixes the binding, not the value, so an object held in a const can still change.
var a = 1; // Function scoped
let b = 2; // Block scoped
const c = 3; // Block scoped, immutable binding
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓