Question discussion

What is the output of the following JavaScript code?

359261Medium DSSSB TGT Computer Science 0 replies 0 views
0
What is the output of the following JavaScript code?
let x = 10;
if (x > 5) {
    console.log("Greater");
} else {
    console.log("Smaller");
}
  • A"Smaller"
  • B"undefined"
  • C"Greater"
  • DError
Correct answer: C

Explanation

x = 10 > 5, so "Greater" is logged.

Discussion 0

Nobody has replied yet. Start the discussion!