📊 JavaScript
Q. The “var” and “function” are __________.
  • (A) Prototypes
  • (B) Data types
  • (C) Keywords
  • (D) Declaration statements
💬 Discuss
✅ Correct Answer: (D) Declaration statements

Explanation:

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.

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.

💬 Discussion


📊 Question Analytics

👁️
225
Total Visits
📽️
4 y ago
Published
🎖️
Kirti
Publisher
📈
98%
Success Rate