Pop #JavaScript quiz!: What will log to the console and why?
console.log(typeof + +"3");
@rcmainak It's JavaScript being JavaScript. It's because JS treats each + as a unary operator, the first operates on the second, and they are both positive so nothing changes, while the second operates on the string which coerces a number. So by the magic of JS, you get the number 3.
@amc aha! fancy stuff...
@amc The typeof and unary plus operator have the same precedence but are right-to-left, hence the interpretation as
typeof ( + ( + "3"))
@amc checked the output. Would like to know what's happening there :sweat_smile: