Mathematical operations
aren't everything though.
We can also work with strings.
So with text in our JavaScript code.
And I want to show this, as well.
Here, I'm logging a value again,
but now I'll log the result of adding two strings together.
Let's say "Max" and then "Schwarzmüller,"
which is my last name.
Now here, I'm using the plus operator,
but I'm not using it on numbers as I did it before,
but instead on strings,
and that will work.
If I save this, you see this as a result.
The strings have been concatenated.
That's how we call this.
You can use the plus operator on strings
to combine them into one string.
Now, here we don't have any blank or white space
between these two words that have been combined
because we didn't add any here in this operation.
If we would want one,
we would have to add one like this maybe.
And that's how we then would get a blank
in that final string as well.
So you can use the plus operator on strings as well
to concatenate those strings.
You can't however, use the minus operator.
So maybe you would think that this could work
and it should maybe return "M" as a result,
but that is actually not what will happen.
Instead, we get NaN as a result,
and that's now not a special text,
but instead, this is a special type built into JavaScript,
which means "not a number."
And you get this type
whenever you perform a mathematical operation
on values where JavaScript then is not able
to yield a number as a result.
And in case of the plus operator, there is an exception.
This is allowed to work on strings,
but for minus, the times operator,
the division operator, and the modulus operator,
all these operators can really only be used on numbers
and not on strings.
But concatenating strings is a common task
and therefore, something you should know.
And again, just as before,
here, I'm doing it in that place.
I am not using any variables.
Of course,
we could store these individual strings in variables
and then combine these variables,
or also store the result of this in a variable,
and then use that variable.
I'm just not doing that here
because I'm not using these values
or the result of this concatenation anywhere else
in this code.