What will be the output of the expression "5" + 3?

Study for the JavaScript Certification Test. Utilizes flashcards and multiple-choice questions; each question includes hints and explanations. Prepare to ace your exam!

In JavaScript, when the + operator is used with a string and a number, the number is coerced into a string and concatenated with the other string. In this case, the string "5" is combined with the number 3.

Here’s a step-by-step breakdown of the operation:

  1. The left operand is "5", which is a string.
  2. The right operand is 3, which is a number.
  3. When the + operator is used, JavaScript converts the number 3 into the string "3".
  4. Then, "5" (string) is concatenated with "3" (string), resulting in "53".

Therefore, the output of the expression "5" + 3 is "53".

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy