Now we learned that there are different
values, strings, and numbers, for the moment,
and, hence, let's start with these values.
A string value is always created in JavaScript code
by using quotes, double quotes,
opening and closing, or single quotes.
So these are two individual single quotes.
It's up to you, you can use either of the two,
you just should be consistent.
If you prefer double quotes,
use them in all your JavaScript code,
and don't switch between double and single quotes.
Now, why do we need those quotes?
Those quotes, double or single, doesn't matter,
act as delimiters to JavaScript and to the browser,
therefore, which is the thing executing our code in the end.
They tell JavaScript where our text starts
and where it ends.
Now, here, I will go with single quotes,
since this is my personal preference, but it is up to you.
And, here, we could now store some value,
for example, 'Hi my name is Max!'
Very important, if you wanna use a single quote
here in the text, and you're using single quotes
for delimiting that text, or if you use double quotes
and you wanna use a double quote in the text
that won't be possible like this,
you have to escape that character instead.
So if I wanna say, 'Hi, I'm Max!'
that would be invalid.
As you can tell, already, by the fact that my IDE
is showing an error, and we have to escape this character.
So we have to tell JavaScript
that it should not treat it as a closing quote
by adding a backward slash in front of it.
That's some special syntax,
which is worth knowing when you work with strings,
because that's how you can add the quote character
inside of a string.
Because the quotes around the text
are actually not part of the text,
but instead delimit the text,
they tell JavaScript where your string starts and ends.
But, with that, we now did create a first string,
and we can also create a number, maybe in a new line,
we can add 32 as a number.
And for numbers we don't have quotes around them,
we just entered a number like this.
Now you might be thinking, okay,
what's the idea behind all of that?
What does this code do?
Well, that's the problem.
This code doesn't do anything because we're not giving
the browser any useful instructions.
We are just creating two values here,
but we're not doing anything with those values.
Now, what could we do with those values?
Well, for a start, we could output them.
We could output them, such that we see them
in some way on the loaded page.
And one way of outputting a value
is to actually wrap that text here, maybe,
with a so-called function.
I'll come back to functions later,
you can forget the term for now because, for the moment,
it's enough if you just type along.
You can write alert, here,
and then an opening bracket, opening parentheses,
and after the text a closing bracket, a closing parentheses,
and then this actually will send
the instruction to the browser.
Alert is a built-in instruction,
which the browser understands,
which actually tells the browser
to show a certain alert overlay on the screen,
and to show this text inside of that overlay.
If you now save this HTML file, and you open this
with that Live Server extension, you should see
Hi, I'm Max! on that screen.
You should get this overlay, and you get this overlay
because of JavaScript.
This is our first, at least a bit,
useful JavaScript instruction,
and we're doing something with that text value, now,
we are sending it as an alert to the browser.
Now, as you can imagine, there are more things
that we can do than just showing alerts.
We can send behind the scenes requests to some server,
we can set timers, we can, of course, also manipulate
the HTML code that's visible on the page, if we had any,
but we're going to dive into those features step-by-step.
But, now, we at least have a first example
of what we can do.
But, with that, we're still not doing anything
with that number.
This 32 value still just sits there and does nothing.
Now, of course, we can all just show this with an alert
if we want to like that.
Also, again, execute this alert command, here,
and then wrap this between brackets, this number.
And that's important,
alert works with both text and a number as you can see.
If I save this and I reload, I get Hi, I'm Max!,
and if I click OK, I get this 32 value,
and if I click OK again, that's gone.
So now we're sending two alerts to the browser,
and that's how we can work with values
and what we can generally do with JavaScript.
What we don't see here, though, are variables.