Predict the output of the following JavaScript code
console.log(2 + '2' + 2);
Quiz Explanation
In JavaScript, when you use the + operator with a string and a number, JavaScript implicitly converts the number to a string and performs string concatenation. So, 2 + '2' results in the string '22'. Then, concatenating '22' with another number 2 results in '22' + 2, which is '22'2. Therefore, the output is 22.