10 simple things about JavaScript.

JavaScript is a high level, just-in-time complied programming language.

If you go to google and search the top 10 popular programming language right now, the first name you’ll see is JavaScript. So it is clear that we can do some incredible things with this language. But before doing so, we must need to know the basics of this language and have some firm grasp on the various sides of this language. Recently I tried to learn JavaScript and I learned some key features about it. Today I’ll share my learning.

JavaScript Engine :

JavaScript engine is a computer program which executes JavaScript codes. The first JavaScript engine were mere interpreters and created by Brendan Elich. But all modern engines use just-in-time compilation for better performance.

JavaScript Engine.

If I say simply then a JavaScript engine is a program which converts the code you did in JavaScript into a lower level machine code. There are many JavaScript engines now. But the most famous one in my opinion is V8 which is used by google.


The building block for any programming language is it’s types. JavaScript also has some types and they are :

  1. Number.
  2. String.
  3. Boolean.
  4. Function.
  5. Object.
  6. Symbol.

The last one is a new edition of ES2015.


From my understanding, function is a block of code which is written to execute a particular job. In JavaScript functions can be written in several ways. Some example will make it clear.

  1. const x = multiply(4, 3);

function multiply(a, b) {
return a * b; // Function returns the product of a and b

2. const multiply = (a,b) =>{

return a*b;



3. const x = function (a, b) {return a * b};
const z = x(4, 3);

All are acceptable in JavaScript. There are some other ways but I found these three ways easy to understand.


Loop is one of the key features of any programming language. Loops are used in JavaScript to perform repeated tasks based on a condition. There are several types of loops in JavaScript and they are :

  • while — loops through a block of code as long as the condition specified are true.
  • do…while — loops through a block of code once; then the condition is stated. If the condition is true, then the loop is repeated as long as the specified condition is true.
  • for — loops through a block of code until the counter reaches a specified number.
  • for…in — loops through the properties of an object.
  • for…of — loops over objects that are iterable such as arrays, strings, etc.

If you are interested then you can go to this link below. It helped me a lot to understand JavaScript loops.

Start with a Semicolon! :

Yes, you heard it right! Most of the programming language you have to use semicolon(;) at the end of every line of a code (Python says hi). But in JavaScript you can actually start your code with a semicolon.

;const number = 10

This will work just fine.


Array is a very powerful feature for any programming language. It is where we store multiple data at once. If I want to store a low number of data then we can use variables. But what if we need to store a huge amount of data and loop through them? Then the solution is an array. For example ,

If we need a small amount of data then we can write ,

const person1= “Sakib”;
const person2= “Rakib”;
const person3= “Zubaida”;

But if we need a huge amount of data consisting of persons name then we will need array like,

const person= [

//And so on.

Immediately-Invoked Function Expression :

Look at the examples below. First one works but second one gives Uncaught SyntaxError: Unexpected token ).

//This Works just fine
const foo = function () {
//codes to be executed.

// And there is a syntax error in this code.
function foo() {
//codes to be executed

You can add properties to almost anything in JavaScript :

JavaScript has only three primitive data types and they are String, Number and Boolean. Everything else unless it in not null or undefined then it can have properties added to it. For example :

const a = {}; //new object

a.b = ‘hi’;

In the above example, a.b meant nothing until you set a value to it. Now a has a property called b. But wait, There is more,

const a = [] //new array;

a.b= ‘hi’;

Now we have an empty array with a property called b.

JavaScript Camel Case :

In JavaScript it’s a good practice to use camel case to name the variables. Sometimes we need to name the variable names relevant to the project or make the code readable. Then we can use camel case. To understand it let’s see an example,

it’s not const howtousecamelcase;

it’s const howToUseCamelCase;

It is important to learn about camel case because most of the time if we see any tutorial on youtube or read any kind of documentation or blog on internet we are most likely to see the codes written on camel case. It is widely used and a good practice to do.

Sorting Arrays with JavaScript :

Sorting array is a very common interview question. While it can be very easy or very tough depending on the situation, I will discuss only .sort() method today.

.sort() method sorts an array alphabetically or numerically. You can use it to sort anything from reverse too. For example ,

const numbers = [30, 75, 10, 45,11, 5,2 17];
numbers.sort(function(a, b){return a — b});

This a — b means it will sort the numbers in ascending order. And then this example ,

const numbers = [30, 75, 10, 45,11, 5,2 17];
numbers.sort(function(a, b){return b— a});

This code will sort the numbers in descending order.

Web Developer, Dreamer, Quick Learner.