Variables: let, const, var

Variables

JavaScript has three ways to declare variables:

  • let — block-scoped, can be reassigned.
  • const — block-scoped, cannot be reassigned.
  • var — function-scoped, avoid in modern code.
let count = 0;\nconst name = "Shinobi";\ncount = 1; // OK\n// name = "Other"; // Error!
Sign in to track your progress.

Q&A / Discussion

No comments yet. Be the first to ask a question!

Sign in to join the discussion.