In JavaScript, variables are explicitly declared and used by the compiler to check type-correctness of function calls, for example.
const declares a constant binding. It cannot be reassigned.
const name = "byexample";
console.log(name);let declares a variable that can be reassigned.
let count = 1;
count = 2;
console.log(count);Variables declared without initialization get the value undefined.
let result;
console.log(result); // undefinedYou can also declare and initialize multiple variables in one statement.
let a = 1,
b = 2;
console.log(a + b);