So allow me to say:
Welcome new programmer, to a whole world of wonder!
Coding is like Hobbits. You can learn all that there is to know about its ways in a month and yet, after a hundred years, it can still surprise you.
This book will teach you the ways of code. The fundamental pieces that we all use. It won’t teach you how to make a Twitter clone in thirty minutes, instead it wil teach you about variables, loops, functions and arrays, the foundational building blocks thateverything we do is built upon.
We were all new coders once. With time and patience you will become the master, and then it will be down to you to welcome new coders, just as I was welcomed, and now I welcome you.
You will find it:
- In your web browser (in pretty much every laptop, desktop and smartphone in the world, probably more than once)
- On your server - NodeJS provides a complete and powerful web server used by some of the biggest companies in the world, companies like Microsoft.
- In desktop apps - like VSCode, Slack, and many others.
Bjarne Sandstrup once said, “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”
Don’t worry if this makes no sense to you yet, in time it will.
You should do these exercises. Coding is like playing an instrument. Reading about it doesn’t really help much, you have to actually do the work with your hands.
Create some HTML
First of all we’ll need to make a web page for our script to live in. Open your favourite code editor (VSCode is never a bad choice). Create the following ultra simple html document and save it in a folder. Call it hello.html. Now double click it to open it in a web browser like Chrome or Firefox.
Write some Script
Hook them up
Now, we need to link the two together. In the head of your HTML document add a script tag like so:
(Note that the script tag cannot be self closing. You have to explicitly close it with an
</script> tag or it will fail.)
What do you get?
Exercise - more alerts
Extend the code so it pops up two alerts.
So what did we do here?