Moshiur Asif
3 min readMay 8, 2021

--

JavaScript special knowledge you need to gain

  1. Truthy value and falsy value:
    truthy value and falsy value are checked in condition. If the variable assigns a number, string, object, and array condition will be truthy But 0, an empty string will be falsy value. Null, Undefined, and NaN also falsy value and false also falsy value return.
    falsy value:
    0, an empty string “, null, NaN, Undefined, false
    truthy value:
    “0”, {}, [], “false” and everything without falsy value

2. Null vs Undefined:
Undefined:
When you declare a variable but not assign you will get undefined.
example:
let a;
console.log(a) // Undefined
When you don’t return a result in function, you call an array element what he hasn’t, and a function parameter you don’t give an argument. You will get Undefined.

Null:
Null is a special value in javascript. A variable is not empty then we assign a null value. When we know it can be fillup other values or there was a value but now empty in this time we set null value.

3. Difference of double equal (==) and triple equal (===)
If you want to check only the value between two variables you will use double equal (==) and If you want to check value and type between two variable you will use triple equal(===)
let a = 2;
let b = “2”;
if(a==b) you will get true they check only value and
if(a===b) you will get false they check value and type

4. Block Bindings: var, let, and const Every parent variable does not get access from their children's block. Parent variable is called global variable and children is called local variable. If any variable declares globally there have access locally. var x = ‘hello’; const greet = () => { console.log(x +’world’) } greet(); // ‘hello world’

5. var, let and const have some differences. If you declare var locally in the local scope you will get access to this outside of the local block. But others let and const will not access outside their block. This system adds after 2015. ES6 module clear and easy these terms so that they are not accessed from the outside of the local block.

6. let Don’t allow re-declared it just assigns a value that will be changed but const is a city constant variable, no one can be declared and re-assign. But var always re-declared and reassign that’s why ES6 releases standard codes.

7. Arrow function ES6 released fat arrow function, It easy and short a function. That’s why functions will be neat and clean and easy to write.

const faf = () => console.log(‘hello’)

8. map() map() function is similar of for loop. ES6 release map() function. For loop is a loop function it will use element and array looping. They will give a single element from an array thronging a map() function. They will give an array, we can store elements in there.

9. forEach() It is also a looping process. They give a single element from an array. To get elements it declares an empty array. all elements are stored in it.

10. try…..catch()
When code is error browser displays an error and the next code after error will not execute. At this moment try…catch() method will help run the code after error. If we write an error in the try block then the error is not executed and the catch block will catch it in the parameter. Then you will see this error in this block.
example:
try{
test()}catch(err){
console.log(err)
}
//output: type error

--

--

Moshiur Asif
0 Followers

Professional full stack web developer