Syntax
JavaScript Declare a Variable Syntax
In JavaScript, declare a variable: declares a block-scoped variable that can change — let count = 0;
Quick Answer
- Syntax
let count = 0;
JavaScriptSyntax
Declare a Variable
Code example
let count = 0;
Declares a block-scoped variable that can change.
How to declare a variable in JavaScript
- Open your JavaScript file or editor.
- Copy the example, then replace its sample names and values for your code.
JavaScript Declare a Variable Syntax
Use let count = 0;.
Related Syntax References
Frequently asked questions
What is the JavaScript syntax for declare a variable?
Use this pattern: let count = 0;
Can I copy this JavaScript code example?
Yes. Use Copy code and adapt the example to your program.
Is this JavaScript syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify