What is the correct syntax for declaring a variable in JavaScript?

  • declare x = 10;
  • var x = 10;
  • variable x = 10;
  • x = 10;
The correct syntax for declaring a variable in JavaScript is var x = 10;. This syntax uses the var keyword to declare a variable named x and assigns the value 10 to it.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *