A

Admin • 828.03K Points
Coach

Q. What is block statement in JavaScript?

  • (A) block that combines multiple statements into a single compound statement
  • (B) both conditional block and single statement
  • (C) block that contains a single statement
  • (D) conditional block
  • Correct Answer - Option(A)
  • Views: 9
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

A block statement (or compound statement) in JavaScript is used to group multiple statements together within curly braces {}. It is typically used in control structures like if, for, while, and function definitions.

Example of a Block Statement:

{
let a = 10;
let b = 20;
console.log(a + b); // 30
}
  • The {} braces group the let declarations and console.log() into a single block.
  • The block does not affect execution unless used in a specific context (like inside an if or loop).

Why Not Other Options?

  • (B) Both conditional block and single statement → Incorrect. A block statement can contain multiple statements, not just a single statement.
  • (C) Block that contains a single statement → Incorrect. A block is meant to group multiple statements, although it can contain just one.
  • (D) Conditional block → Incorrect. A block can be used inside conditionals, but it is not limited to them.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.