JavaScript · Junior · Question 12 of 75

What are '5' + 3 and '5' - 3?

Explanation

If one operand of + is a string, concatenation happens. Other arithmetic operators convert operands to numbers. That's why values from input.value are converted with Number() before adding.

Further reading

Problem with a question

JavaScript · Junior · question 12

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz