2 min read

Introduction to JavaScript

Introduction to JavaScript

You might have heard of many newly released frameworks to help you develop web applications and even mobile apps faster and productively in a structured fashion. Most of the frameworks are based on JavaScript. JavaScript is the backbone of modern web development. They are lightweight and extremely powerful. There was a time when JavaScript’s roles were limited to the client side. The days are gone, and JavaScript can play both frontend and backend roles as well.

Primitive Types

Primitive Types are the basic building blocks of JavaScript. There are five primitive types you need to know to continue your JavaScript journey. They are:

  1. Number
  2. String
  3. Boolean
  4. Null
  5. Undefined

Technically there are two others: Symbol and BigInt. But we don’t have to worry about this as it is used very rarely.

However, we will learn the five primitive types as we go on learning inshaAllah.

Start Coding

First, we will run our code using the Chrome developer tool’s console.

After practicing for a while in the console, we will learn how to write external scripts along with HMTL, inshaAllah.

Anyway, for this tutorial we will stick to console. So, let’s open the console.

  1. Open Google’s Chrome browser.
  2. Right-click > Inspect > Console.

Now that you are in the console, try the following operations.


  1. Add two numbers. 100 + 85
  2. Subtract two numbers. 100 - 85
  3. Divide two numbers. 100 / 3
  4. Try adding decimal numbers. 10.50 + 1.50
  5. Add two numbers and multiply them by the third number. (5 + 5) * 10

You just practiced number type of the five primitive types.


Now let’s add Modulo to it. Modulo is commonly used to determine whether a number is even or odd. Modulo gives the remainder of a number.

If you try 19 % 2 in the console, your answer would be 1. If the remainder is 1, it is an odd number. Otherwise, it will become a 0 making it an even number.


The exponent of a number says how many times to use the number in a multiplication.

i.e: 8 to the Power 4 (84) = 4096

Try 8 ** 4 in console and it will return 4096.


NaN = Not a Number

When you do an operation with something that is not a number, it returns NaN.

If you divide 0 by 0 that operation will not be valid.

Try 0 / 0 in console and your return value would be NaN.

That’s it.


If you would like to read more on JavaScript, go through IF Statement and For Loops.

If you prefer to watch, visit my YouTube channel, and don’t forget to subscribe 🙂