Semantic HTML
Semantic HTML makes the HTML more comprehensible by better defining the different sections and layout of web pages. It makes web pages more informative and allowing browsers and search engines to better interpret content.
React Hooks
Hooks are new feature in the React 16.8 version. It allows to use state and other React features without writing a class. It does not work inside classes. It allows to build functional-based components.
Null vs Undefined
Undefined means that a variable has been declared, but hasn’t been assigned any value. And null refers to a non-existent object, which basically means empty or nothing. Both values are used to indicate the absence of something.
Double and triple equal
When we compare two variable and use double equal for compare then it check only value not type. On the other hand triple equal check the type.
const number = 1234
const stringNumber = '1234'
console.log(number == stringNumber) //true
console.log(number === stringNumber) //false
map()
This method creates a new array with the results of calling a function for every array element.It is a non-mutating method
Scope
Scope determines the visibility of these variables. There are two types of scope, Local scope and Global scope. A variables declared in function is called local variable. And outside the function is called global variable.
Javscript async/await
async keyword with a function to represent that the function is an asynchronous function. The async function returns a promise.
async function name(parameter1, parameter2, ...paramaterN) {
// statements
}
Window object
The window object represents an open window in a browser. Window is the object of browser, it is not the object of javascript. The javascript objects are string, array, date etc.
new keyword
The new operator is used to create an instance of an object which has a constructor function.
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const myCar = new Car("BMW", "X5", 2015);
const igorCar = new Car("Tesla", "Model S", 2020);
const laurenCar = new Car("Ford", "Escape", 2015);
console.log(myCar); // Car { make: 'BMW', model: 'X5', year: 2015 }
console.log(igorCar); // Car { make: 'Tesla', model: 'Model S', year: 2020 }
console.log(laurenCar); // Car { make: 'Ford', model: 'Escape', year: 2015 }
this keyword
This keyword refers to the object it belongs to. In an object method, this refers to the owner of the method.
var person = {
firstName: “John”,
lastName : “Doe”,
id : 5566,
fullName : function() {
return this.firstName + “ “ + this.lastName;
}
};