A

Admin • 833K Points
Coach

Q. In JavaScript which of the following is used to declare variable

  • (A) var
  • (B) dim
  • (C) function
  • (D) const
  • Correct Answer - Option(A)
  • Views: 21
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

The correct answer is both (A) var and (D) const.

But since only one option is usually expected, (A) var is the traditional and direct answer.

Explanation:

  • var is the original way to declare variables in JavaScript.
  • const (and let) were introduced later (in ES6) for better control.
  • dim is from VBScript, not JavaScript.
  • function is used to declare a function, not a variable.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.