The last post, and also the first, in this series was referenced as "0" - a nod to how programming languages generally index items in a list as well as indicating it was something of a prologue.
I ended that post by saying this one would focus on:
How to install node.js and make it say hello
However, I realized in consdering this post that installing node is sort of a chore itself. We can actually get our feet wet just using the browser you are staring at right now and still completely ignore web pages as well.
What kind of sorcery is this? Simple - we're just going to change the most fundamental part of your browser.
The location bar. That thing above this post which should say something like "joshbirk.herokuapp.com" and the like.
How? Well the page you are viewing right now was transported to you via a specific protocol. Like a secret handshake that both the browser and server understand. Probably HTTP (HyperText Transfer Protocol). You may not see http:// in the location bar above this page because most browsers hide it as it's just the assumed, but your average URL looks something like:
http:// www.domain.com / yourpage.html
The spaces divide it into protocol, domain and resource. Your browser (probably) understands a lot of other protocols. When you shop online, you should see https in the location with a friendly icon telling you it is secured. HTTPS is like HTTP for serving web pages, but with a layer of encryption added.
Now in your location bar, type the following and hit return. You will probably have to type it out, as browsers like to reform protocols with links. Don't worry this page (probably) won't go anywhere.
We'll use one you rarely need anymore. Type the following into your location bar:
So now type:
Boom - same outcome. You established "s" as a variable (shorthanded to var) and gave it the value "Hello!". You then passed that variable to the alert function. Functions take what we call parameters to determine how they should run. To the alert function, this and the previous command are identical.
So why put it "Hello!" into a variable if alert sees it exactly the same way?
Your homework is to ponder on that. Next we will look at variables and functions more closely.