Remember the "Hello, World!" program we made last time?
Engagement Message
What was the main job of that console.log()
command?
The job of console.log()
is to show something to you, the person running the program.
When a program shows information or results to the user, we call that output. So, console.log()
creates output.
Engagement Message
With me so far?
We've seen console.log()
used with text inside quotes, like "Hello!"
. But console.log()
can also create output for other types of information.
For example, you can print numbers like this:
console.log(42)
Engagement Message
What do you think this would show when you "run" it?
Did you notice something different? When we print text like "Hello!"
, we put quotes around it. But when we print a number like 42
, we usually don't.
This difference in how you write text versus numbers is part of JavaScript's syntax
that we talked about.
