Skip to main content

How to Learn JavaScript: A Beginner’s Guide

February 3, 2021

How to Learn JavaScript: A Beginner’s Guide

Ready to Learn JavaScript but not sure how or where to get started? No worries at all. This tutorial has got you covered. It will teach you all there is to know about JavaScript as a beginner and help you get started with it.

Are you excited about learning JavaScript and curious about how it works and the wonderful things you can do with it? JavaScript is a very powerful programming language and at the same time, a very simple and “easy to flow with ” language to learn. Most especially for those who are new to programming.

No need to be nervous. JavaScript is simple and easy to learn and only requires your patience, discipline, and lots of practice to get acquainted with it and hopefully get hooked on it (you won’t want to stop coding because of the endless things you can achieve with it).

JavaScript – The Language of the Web

a young man learns javascript

Speaking the language of the web was considered impossible until JavaScript came into existence. Web pages consisted of Html and CSS which could not change state (be dynamic) or perform any logic when retrieved by the browser.

This made the web look static and even worse, lifeless as it can not move nor interact with itself or perform any extra function. Fortunately, we were blessed with a man – Brendan Eich who was able to build the language of the web in ten days and change the way the web will be perceived for decades to come.

Fundamentals of JavaScript

When we learn a new language, one needs to get familiar with the basic building blocks, know what they are and the role they play collectively. Below are some of the few basic blocks you need to understand to get started with JavaScript.

  1. JavaScript Engine: JavaScript was originally created for the web and there was a dire need of an engine or machine to run the scripts, so the JavaScript engines were created and embedded into web browsers. Nowadays, the engine can be found in other applications. What the browser does is parse the script and check if it fulfills all the requirements of the language before moving on to compiling it and converting it to a language the computer understands.
  2. Syntax: Syntaxes are rules that govern how words, symbols, and other entities are combined together to form a working JavaScript program. Some of the syntaxes are curly braces {} for blocks of codes and semicolon ; to denote the end of a line.
  3. Variables: Variables are memory locations on the computer for storing values. Think of variables as jars and sugar cubes as values stored in them. Variables are declared by the keywords “let” and “var” and assigned a value by the assignment operator “=”.
  4. Comments: Comments are words written to describe a code and what it does. These are written to make your code easier to read and understand by other people. A single-line comment is written by adding two trailing slashes (//) before your description and a multi-line comment is written by adding a slash and asterisk (/*) at the start of your description and an asterisk and closing slash (*/) at the end of your description which must have spanned multiple lines.  Once the engine discovers these symbols before and after your descriptions, It will automatically consider It a comment and won’t try to act on them.  

Writing your first JavaScript Program

All that is needed to write a JavaScript program is a working web browser (remember that JavaScript was originally created for the web). The browser contains a JavaScript engine that executes JavaScript programs. All major web browsers have a JavaScript engine embedded in them. Chrome uses the v8 engine and Firefox uses the SpiderMonkey engine. To write your first program,

  • Open your browser(I’m using firefox) and type ‘about:blank’ in the URL box. This is just to open a blank page.
  • Open the Inspecting console (a tool for quickly testing JavaScript programs) by holding Ctrl+Shift+I for windows and Linux users and Cmd+Option+I for Mac users.
  • Once opened, switch to the console tab if not already there and you will notice two angle brackets “>>” and a blinking cursor.
  • Go ahead and write – console.log(“Hello World”) and hit the enter key. You will get a result on the screen showing Hello World. “console.log()” is a function used to print out.

If you see exactly what you told the console to print out (“Hello World”), then you did it right. 

It feels good to have finally written some JavaScript code and see it do what you asked it to do.

You have just scratched the surface of this language as there is a lot to learn. If you are feeling up to the task and excited to know more about JavaScript, then you should definitely check MDN’s tutorial and the read JavaScript – The Definitive Guide by David Flanagan.

If you truly want to learn JavaScript and learn in an interactive and fun environment like JavaScript itself (JavaScript makes web pages interactive), your best bet is to take a lesson with a tutor on TakeLessons.


Adedayo Ajao