Every Javascript must know, Intermediate javascript

React Hook:
A Hook is a unique feature that lets you “hook into” React features. For example, useState is a Hook that lets you add React country to feature components. We’ll analyze other Hooks later.
useSatate() hook:
It broadcasts a “state variabl.This is a way to “preserve” some values between the characteristic calls useState is a new way to use the actual equal abilities that this.state presents in a class. Normally, variables “disappear” when the feature exits, however, nation variables are preserved by using React.
useEffext() hook:
This is used if you want to load data from somewhere else.
Truthy and Falsy:
As properly as a type, every cost additionally has an inherent boolean value, normally recognized as both truthy or falsy. Some of the guidelines are a little weird so appreciating the ideas and impact on contrast helps when debugging JavaScript functions.
Everything is truthy. That includes:
- 20 (every number is truth other than 0).
- “ ” (every string is truth other than the empty string “”).
- “0” (a string containing a single zero).
- “false” (a string containing the text “false”).
- [] (an empty array).
- {} (an empty object).
- function () {} (an “empty” function).
Everything is falsy. That includes:
- false
- 0 (zero)
- “” (empty string)
- null
- undefined
- NaN
DoubleEqual (==) VS TripleEqual (===):
If you aren’t sure what the difference between == and === are in JavaScript, then you will not be disappointed, I will explain it
DoubleEqual (==):
Double equals are formally recognized as the abstract equality evaluation operator or unfastened equality. it will evaluate two factors irrespective of their datatype. It additionally converts the variable values to the equal kind earlier than performing an assessment.

TripleEqual (===):
Triple equals are termed the strict equality evaluation operator or identification operator, however, it will examine two elements by using fee and datatype. Strict operators do no longer convert the variable values to the equal kind earlier than performing an assessment however instead, it returns actually solely if each value and sorts are the same for the two-variable in contrast.

.map():
Let me provide an explanation for how it works with a simple example. Say you have obtained an array containing more than one objects — every one representing a person. The element you without a doubt want in the end, though, is an array containing solely the identification of every character.

.filter():
The filter() technique returns a new array created from all factors that ignore a sure check carried out on a unique array.
The following instance makes use of filter() to create a filtered array that has all factors with values much less than 10 eliminated.

.find():
The JavaScript Array.find approach is a convenient way to discover and return the first incidence of a thing in an array, beneath a described trying out function. When you choose a single needle from the haystack, attain for find()!.
We can use find() to easily search arrays of objects, too!

Scope:
The scope is vital thinking that manages the availability of variables. If you’d like to code in JavaScript, appreciation of the scope of variables is a must. So, I will provide an explanation for how the scope works in JavaScript.
The main issues in scoping are:
. Each new function creates a scope where you can access your variables or functions.
. Each new function creates a scoop.
. Parent-child relationship in Lexical Scoping.
. Variables declared in one function cannot go to another function, meaning they cannot be accessed.
Block Scope:
A code block in JavaScript defines a scope for variables declared the use of let and const:

The first console.log(massage) successfully logs the variable due to the fact message is accessed from the scope of the place it is defined.
But the second console.log(massage) throws a reference error due to the fact message variable is accessed outdoor of its scope: the variable doesn’t exist here.