Function Declaration or Statement Function Expressions Function Hoisting A function created using Function Declaration or Statement can be called even before its declaration as shown in below example. However functions created using Function Expression can only be called after it has been declared. This is the key difference between a Function Declaration and Function Expression….
Month: May 2021
Spread Operator Usecases {…object} […array]
Spread Operator makes life much easier for JS developers when it comes to doing basic operations on Arrays and Objects. Below are some examples of Spread Operator. Spread Operator Syntax : Array : […array] Object : {…object} Deep Copying Objects and Arrays Concatenating Objects and Arrays Adding new values to Objects and Arrays Spreading Arrays
Shallow Copy Vs Deep Copy in Java Script
Shallow Copy When you shallow copy an object there is no new memory space that is allocated to the duplicate object. Thus both original and duplicate object shares the same memory space. As a result of this, changing the attributes in one object changes the attribute in the other. Below is an example of a…