What's going to be printed to the console? (think well, then click for the answer and explanation)
In the first line, we define the variable `str` and initialize it as a string with the value `1`.
In the second line, there are two typecasts, first !str
gives us false
and then +false
converts boolean into a number 0
.
Eventually, in the third line, the typeof
operator looks up the current type of str
which is number
.
ANSWER: string number
will be printed to the console