What is the correct syntax for declaring a variable in JavaScript?
- var myVariable = 10;
- let myVariable = 10;
- const myVariable = 10;
- myVariable = 10;
In JavaScript, variables can be declared using the var, let, or const keywords. Option 2 shows the correct syntax using the let keyword, which is commonly used for variable declaration in modern JavaScript.
Loading...
Related Quiz
- Compare and contrast binary search trees (BSTs) and AVL trees.
- What is the significance of the time quantum in Round Robin scheduling?
- What is the purpose of the "Content-Type" header in RESTful API requests?
- What are some common challenges teams face when transitioning to Agile methodologies?
- The ___________ statement in SQL is used to remove one or more rows from a table.