Make Your Basic Strong in JS

Genius
2 min readMay 8, 2021

Truthy vs Falsy Value

Truthy values are values that evaluate to True in a boolean context. Falsy values are values that evaluate False in a boolean context.

All values are truthy unless they are defined as falsy (except for: false, 0 , -0, 0n , “”, null , undefined, and NaN )

Null vs Undefined

In JavaScript, undefined is a type, whereas null an object. undefined means a variable declared, but no value has been assigned a value. null in JavaScript is an assignment value. You can assign it to a variable.

Local variable vs Global variable

There are two types of variables in Javascript.

  1. Local variable
  2. Global variable

Local variable can be accessed inside the function while the global variable can be accessed from anywhere. A global variable declared outside of the function. Here in the example c is a global variable and it can be accessed anywhere from the script. On the other hand, result is a local variable. It is only accessed inside of the cost function.

Double Equal vs Triple Equal

Double equal checks only the value is the same or not. It doesn’t check the type of the variable. Triple equal check both the value and type of variables.

--

--

Genius
0 Followers

Curious Learner of JS and its framework