The 10 Topics of JavaScript you should know in 2020

Abdul Basir
4 min readAug 19, 2020

The list we are going to learn…

1. Variable (var, let) and const

2. For loop

3. Data types

4. Conditionals (if.. else)

5. DOM

6. Array

7. Object

8. Map, filter, find

9. Function

10. operator

1. Variable and constant

When you are reading this article you probably know about variable and constant. These are the most basic you need to learn JavaScript.

We can declare variable in two way:

1. Using var keyword

2. Using let keyword

There are few differences between var and let. Var is a global variable. The scope of var variable is the full web. we can initialize value before declaration when we using var keyword. But we cannot initialize value before declaration using let keyword.

There are some value those are not changed entire full page. We declare these value using const keyword. You must set a value when you declare variable using const keyword.

let and const have block scope. You cannot access out side the scope.

2. for loop

The most useful loop in javascript. Ther are two more loop in javascript. ‘while’ loop and ‘do while’ loop.

When you want some result base one a condition think about for loop. This will give you very easy and fast solution. When you want to apply loop on an array you can think about .foreach(), .map(), .filter(), .find() .reduce() and many more method but the for loop makes the speed of your website. Try to skip .foreach() method it can be cause for losing your site speed. You can use other method if you want. We will talk more about this.

3. Data Types

You should clear about data type. Most of developer got confusion of data types number and string. When we pick a value from input field it’s always string data type though you input some number. So when you want to work with input field number try to convert the value into number using perseInt(), parseFloat(), parseFloor(), parseCeil() methods.

Null and undefined: These two word confused us many time. let’s clear. undefined means we did’t set a value of something where null is it’s own value. value of null and undefined is same but there types are difference. Null is object type where undefined is undefined type :) . We will talk more about this later.

4.conditional (if else)

You can’t do any project without condition . You can do any single loop without conditionals. The most used condition is if else. You should have clear knowledge about this conditional. Everything in our practical life is also happening base on conditions.

the things you should remember about if else that there are few methods for writing this condition. look at them and practice most. Because practice makes a man perfect.

5.DOM

DOM(document object model). You should earn a clear concept of DOM. This is the flow of code. Most of the time you need to create an element with javascript and need to put inside any html element. Then the concept of DOM come here. suppose we put a ‘p’ element inside a ‘div’ element then the div will be the parent element of ‘p’ and ‘p’ is the child element of ‘div’. So if we want to put any element inside any element with JavaScript then we have to use parent.appendChild(child) this.

6. Array

Array is one of the best interesting topic in js. Array has a lot of method. I see necessary of knowledge about array when I was learning about ‘api’. When we fetch data from api and we convert json then we need to be cleared about array. We can do all array operation using array 4 methods. .map(), .find(), .filter(), .

7.Object

Object is on of the most useful things in javascript as well as our life. In fact we all are object. I will explain letter. Let’s talk about object in JavaScript.

Object made with property and value pair. when we didn’t put any value it will consider as an empty object. We can declare empty like this.

  1. const myObject= {}

then we can put property and value like this.

myObject.name = “Abdul Basir”.

we can now access name like this => console.log(myObject.name) //Abdul Basir

8. map, filter, find

Those three are array methods . These are very useful. let’s see example.

I have an array , const num = [1, 2, 4, 6, 11, 28, 99];

map: We can use map in this array instead of for loop. when we use map to this array we will got every element and then we can do anything with that element.

filter: Filter method will filter your array according to your condition and filtered also give you return an array. Let’s we want the numbers which are greater than 25. This can we do like this

const filterNum = num.filter( n => n > 25 ) //[28, 99]

find: Find method will return only one element according to your condition.let’s check whether a number has 13 or not.

const checkNum = num.find(n => n===13) //null

9. function:

function is the most useful thing for all programmers. we can call function in two ways . check below these two function both are same.

  1. function add(a, b){

return a + b

}

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

return a + b

}

console.log(add (3, 5)) // 8

second system is come in ES6.

function help us to reduce and clean code.

10. operator

Operator is those which used everyday by us. We always busy with comparing. yes I am talking about comparing. +, — , * , /, % , = those are basic operator we used every moment.

operator is mostly use when we try to write conditional. like if(3 > 5){

console.log(‘3 will be lost by 5’) ;

}

above condition is true so we will get the output and if we write a condition which is false then it will not give any output.

That’s it for today. We will discuss again with any other boring topic. thank you :

--

--

Abdul Basir

Front end web developer. I love to learn and share my learning knowledge with everyone