JavaScript Declaring and initializing constants


Example

You can initialize a constant by using the const keyword.

const foo = 100;
const bar = false;
const person = { name: "John" };
const fun = function () = { /* ... */ };
const arrowFun = () => /* ... */ ;

Important
You must declare and initialize a constant in the same statement.