console.log(1 + “2” + “2”);console.log(1 + “2” + 2);console.log(1 + 2 + “2”);console.log(“1” + “2” + 2);console.log(1 + 2 + “2”);console.log(“1” + “2” + “2”);console.log(1 + 2 + 2); **
The output of the following JavaScript statements will be:
“122”“122”“32”“122”“32”“122” 5
Explanation:
In the first statement, the addition operator is used to concatenate the string “1” with the string “2” twice. So, the output will be “122”.
In the second statement, the string “1” is concatenated with the string “2” and then the number 2 is added to the resulting string. So, the output will be “122”.
In the third statement, the numbers 1 and 2 are added together to make 3 and then the string “2” is concatenated to the resulting number. So, the output will be “32”.
In the fourth statement, the string “1” is concatenated with the string “2” twice, and then the number 2 is added to the resulting string. So, the output will be “122”.
In the fifth statement, the numbers 1 and 2 are added together to make 3 and then the string “2” is concatenated to the resulting number. So, the output will be “32”.
In the sixth statement, the string “1” is concatenated with the string “2” twice. So, the output will be “122”.
In the seventh statement, the numbers 1 and 2 are added together to make 3 and then the number 2 is added to the resulting number. So, the output will be 5.