Truthy and Falsy Values, null vs undefined, (==) vs (===), map, filter, find, bind, call, apply

Mainul Islam Faruqi
3 min readNov 5, 2020

1.Truthy and Falsy Values:

  1. Truthy: true, “String”, {}, [], and all values are truthy
  2. Falsy: false, 0, “”, null, undefined, NaN, -0, 0n

2. null vs undefined:

  1. null: null used for intentionally missing values. It is also one of the primitive values. null is a falsy value for boolean operations.
  2. undefined: undefined unintentionally missing values. It is also one of JavaScript’s primitive values. undefined is also a falsy value. When just declare a variable, not initialization, the get undefined

3. double equal (==) vs triple (===):

double equal and triple equal compare two things. But double equal (==) compare two things but not checking the type of value. Ex. 0 == “0” here are two zero but one is a number and another is a string. Double equal does not check the type of value and it returns true. That means Abstract Equality comparison (==). 1== true(number and boolean) are not the type of value but double equal returns true.

On the other hand, triple equal (===) strictly compares two things. previous ex. 0 == “0” it returns false. Because types are not equal.

4. map:

map() method runs for an array and looping through it and returns a new array.

If you are using multiline, you have to return a specific thing.

5. filter:

filter() is almost similar to map(). It returns an array after the condition is true.

6. find:

find() method returns the value of the 1st matching elements.

7. bind():

To use a method of an object into another obj, we can call bind() method. It returns a new function. And its this keyword set to the provided value which is an object

8. call():

call() method is almost similar to bind() method. call() method has a extra feature. we can pass extra arg if we need it. Here is the call method for the previous example.

1st arg is the value of this keyword

9. apply():

apply() method is almost similar to call() method. When we call apply() method you need the this keyword value as 1st parameter, and pass all the needed arg as an array.

10. bind() vs call() vs apply():

--

--

Mainul Islam Faruqi

I am a full-stack web developer. Programming makes our life better. Writing code is my hobby. I am very passionate to write code.