First Lesson in Javascript

We chose Javascript to start of our lessons with because by itself it can be a tough language to learn. But if we take it in slow steps and practice more we can learn much easier!

Just like how English has sentences, Javascript has ‘statements’. It even has it’s own grammar rules called syntax. It’s strict to follow and must be proper but I’ll post examples so it’s easy to correct.

 

Let’s start! Open your favorite code editing website or software. For this lesson I recommend a code editing website as I’ll be showing you an example from codepen.io.

In the JS window, short for Javascript, write the following statement:

alert(“Hi, everyone!”);

This will create a pop-up window with your message in it. Don’t forget to include the symbols  ( ) ” ”  and ;  like the example:

alert() example and result

If you have proper syntax it will display correctly. Now change the sentence inside the quotation marks to “Coding is fun” or any other message you want! Remember not to post personal details like your address or passwords.

alert() is a keyword. Lot’s of statements start with a keyword but a lot don’t. We’ll learn more about them later. For now, post a picture of code you wrote on Facebook and Twitter!

Leave a comment