How to declare and initialize a variable in javascript?

In JavaScript, you can use the let, const, or var keyword to declare variables.


  var name = "John";


It's recommended to use let for variables that will change and const for constants:

  let age = 30;
  const pi = 3.14159;

Beginner's Guide to JavaScript