Aryan PrajapatKnowledge Contributor
What would be the result of 1+2+'3' in js
What would be the result of 1+2+'3' in js
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
In JavaScript, the expression 1 + 2 + ‘3’ will be evaluated as follows:
Addition of Numbers: The first two operands 1 and 2 are numbers, so JavaScript will add them together, resulting in 3.
Concatenation with String: The result 3 (which is a number) is then concatenated with the string ‘3’. In JavaScript, when a number is added to a string, the number is converted to a string and concatenated with the existing string.
So, 3 + ‘3’ becomes ’33’.
Therefore, the result of 1 + 2 + ‘3’ is the string ’33’.