Question:

Which of the following symbol signifies the start and end of a JavaScript block?

Show Hint

Curly brackets \{\} define blocks in most programming languages such as JavaScript, C, C++, and Java.
  • semicolon
  • square bracket
  • curly bracket
  • round bracket
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Understand JavaScript blocks.

In JavaScript programming, a block of code refers to a group of statements that are executed together. These blocks are commonly used in structures such as loops, conditional statements, and functions.

Step 2: Identify the symbol used for blocks.

JavaScript uses curly brackets { } to define the start and end of a block of code. Everything written inside these brackets is considered part of the block.

Example:

if (x>10) {
    console.log("Number is greater than 10");
}
Here the curly brackets define the beginning and end of the code block executed when the condition is true.

Step 3: Evaluate other symbols.

Semicolon ( ; ): Used to end individual statements, not blocks.

Square brackets [ ]: Used mainly for arrays and indexing elements.

Round brackets ( ): Used for conditions and function parameters.

Step 4: Conclusion.

Thus the symbol used to define the start and end of a JavaScript block is the curly bracket { }.
Was this answer helpful?
0
0