All right, so take a look at this. What am
I going to print out to the console? If
you said 132, then that is a fantastic
guess, but you haven't been paying
attention at all to anything I've been
saying, because that's 130. And that's
weird, and that's not what we expect.
Because I want to keep things pretty and
line them up nicely. And everybody likes
nicely lined up code. So, you know, 002.
Let's keep everything clean and neat and
organized. And so, this is going to be our
132. No, it's not, because I didn't add
the z. Now it's going to be our 132. Okay,
here's what's happening. If you stick a
zero in front of a number in JavaScript,
JavaScript's trying to be helpful, says,
"Hey, that right there is an octal number.
" Which is kind of a weird way to define
an octal number. So, that's how it works.
So 012 in octal is 10. So, 120 plus 10 is
130. And that's exactly what we would
expect if we knew that we were dealing
with octal. But we don't, so just for
reference, if I want to do hexadecimal, I
do x. Now I'm going to get 140 that I
would expect from hexadecimal, because 12
in hexadecimal is actually 18, right.
Okay, so let's fix this. I want to be able
to line up my numbers appropriately and
say hey, we can't do zero, zero. And
actually, there we go. Remember, I can't
do that. So, in this case, 'use strict' is
just preventing us from doing something
that we didn't even necessarily realize we
were doing. Zero doesn't work. If I want
to use octal, then I have to actually
convert it using parsing. So if I really
want to use octal, like I really want this
12 to be octal, I'm going to do this
instead, I'm just going to do a parseInt.
And then this second parameter to my
parseInt actually gives me the ability to
set it to octal. So, we're just
eliminating that shortcut zero thing. So,
if I expect that to be eight, let's get
rid of the z here just to avoid confusion.
120 plus this now equals 130. So, 12 in
octal is really only 10 in decimal. So, I
can still do octal with 'use strict'. But
this is going to cause an error, because
it's going to behave differently than how I would expect it to.