K

Kirti • 10.45K Points
Tutor II

Q. The “var” and “function” are __________.

  • (A) Prototypes
  • (B) Data types
  • (C) Keywords
  • (D) Declaration statements
  • Correct Answer - Option(D)
  • Views: 162
  • Filed under category JavaScript

Explanation by: Mr. Dubey

var is used to declare variables.

  • function is used to declare functions.

Both are declaration statements because they define variables and functions before execution.

Example:

var x = 10;  // Variable declaration
function greet() {  // Function declaration
    console.log("Hello!");
}

Why Not Other Options?

  • (A) Prototypes → Incorrect. Prototypes are used in object-oriented JavaScript but var and function are not prototypes.
  • (B) Data types → Incorrect. var and function are not data types like string, number, etc.
  • (C) Keywords → Partially correct, but they are mainly declaration statements, not just reserved words.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics