Hook
More breakout videos from this creator.
Javascript is an interesting language because the plus operator can add two numbers. You can also use it to concatenate strings together. One operator, twice the fun. And this lets you ask questions. If what if you add numbers just to a string? It just converts everything to a string. If we want this to be treated as addition, then we can use a plus as a unary operator of the strings. Javascript converts these strings into numbers. So if you were to give it a string like "042" up, we would end up with the number 42. And if we give it the string "sam" up, we end up with NaN. If the, if the, if I add the letter o to the end of this, we get NaN. Converts string NaN to the string "NaN" and adds the letter o to the end. This means that I can add a bunch of letters together like this. But if I add a unary operator right, getting banana. Which sounds pretty British. Banana.