5 most important topics of JavaScript you should definitely know

Sudipto Kumar Mitra
3 min readMay 9, 2021

--

In this article, I will discuss the five most important JavaScript topics that you will need in everyday life as a JavaScript developer again these are the most important topic in any interview session.

So, let’s begin.

Here is the list:

  1. Null vs Undefined
  2. == vs ===
  3. Truthy and Falsy value
  4. Arrow function
  5. This Keyword

1. Null vs Undefined

null and undefined are JavaScript primitive types. Let’s talk about the differences between them. undefined is used for unintentionally missing values. The meaning of undefined is to say that a variable has declared, but it has no value assigned. If we declare a variable and don’t assign a value to it, it will be undefined. When we return nothing from a function, at that time we get undefined.

on the other hand, null is used for intentionally missing values. Null means nothing.

The data type of undefinedis undefined but the data type of null is object.

let man;
typeof man
//output: undefined
let age = null
//null

2. == vs ===

These are the comparison operator. Comparison operators are used in logical statements to determine whether two variables or objects are equal or not.

If we check with == that means we are checking only values not type. But if we check with === it will check the value and also check the data type. So, using === is safer.

var x = 1;
var y = '1';
if(x == y){
console.log('Same value');
} else{
console.log('Not the same value')
}
//output: Same value
const x = 1;
const y = '1';
if(x === y){
console.log('Same value');
} else{
console.log('Not the same value')
}
// output: Not the same value

3. Truthy and Falsy value

Sometimes we need to check something is true or false. If we found true that is truthy value and if we get false that is falsy value.

A falsy value is a variable that evaluates to false. In JavaScript, there are seven falsy values - false, 0, "", [], null, undefined, NaN.

const input = 0;
if(input) {
console.log('Truthy value');
} else {
console.log('falsy value');
}
//output: falsy value

4. Arrow function

Arrow function is one of the features introduced in the ES6 version of JavaScript. It allows you to create functions in a cleaner way compared to regular functions.

//normal function
var fun = function(){
console.log("normal function");
}
fun();
//arrow function
const fun1 = () => console.log("arrow function");
fun1();

If the arrow function has only one line, we can declare it as the code you found above otherwise, you can use the {}.

5. This Keyword

The this keyword is one of the most widely used and yet confusing keyword in JavaScript. It means what are we using now. see the code below to clear it.

const Car = {
name: 'Car',
price: 2000,
getPrice: function (tax) {
console.log(this.price + tax);
}
}
Car.getPrice(500);
//2500

The Conclusion

So, these were the 5 most Important JavaScript topics, you can find more useful topics by searching or checking MDN Web Docs. This helped me in my learning journey. And I believe it will be of importance to you, too.

Thank You.

--

--

Sudipto Kumar Mitra
Sudipto Kumar Mitra

Written by Sudipto Kumar Mitra

I am a recent Computer Science graduate with knowledge of software development and design. Currently React JS and Flutter enthusiast.

No responses yet