aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • JavaScript and J2EE Web Technologies
  • To what value will the following expressions evaluate in ...
Multiple choice technology web technology

To what value will the following expressions evaluate in the JavaScript console?5 + true

  1. 6

  2. 5

  3. true

  4. NaN

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In JavaScript, true converts to 1 in numeric contexts, so 5 + true evaluates to 6. This demonstrates JavaScript's type coercion where booleans convert to numbers in arithmetic operations.

Keep practicing — related questions

  • To what value will the following expressions evaluate in the JavaScript console? NaN == NaN
  • To what value will the following expressions evaluate in the JavaScript console? 011 * 2
  • To what value will the following expressions evaluate in the JavaScript console? a = 4; b = 6; a+++b;
  • To what value will the following expressions evaluate in the JavaScript console? typeof 1/0
  • what value will the following expressions evaluate in the JavaScript console? "6" + "5" * 2
  • To what value will the following expressions evaluate in the JavaScript console? (16).toString(16)
  • To what value will the following expressions evaluate in the JavaScript console? "abc"[2]
  • To what value will the following expressions evaluate in the JavaScript console? typeof typeof null
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy