Blog-1
What is the difference between an arrow function and a regular function?
The differences between var, let, and const variable declaration in JavaScript include: Variables declared with var and const are scoped to the immediate function body. Variables declared with the var keyword are hoisted. Hoisting means that the variable can be accessed in their enclosing scope even before they are declared. Variables declared with the let keyword are block-scoped, which means the variables will have scope to the immediate enclosing block. Let us now discuss, in detail, how these keywords can make a developer’s code more efficient and how to use each keyword to declare variables in JavaScript programs.
Blog-2
what are the differences between var let and const?
JavaScript arrow functions are roughly the equivalent of lambda functions in python or blocks in Ruby, but they have more intricate details. Arrow functions allow a developer to accomplish the same result with fewer lines of code and approximately half the typing.
Unlike regular functions, arrow functions don’t have their own this or arguments binding. Instead, those identifiers are resolved in the lexical scope like any other variable.Unlike regular functions, arrow functions do not have their own this. In the case of an arrow function, this refers to the values of this in the environment the arrow function is defined in (i.e. "outside" the arrow function) and that remains the same throughout the lifecycle of the function and is always bound to the value of this in the closest non-arrow parent function.
Blog-3
What are the difference between forEach, map, filter and find in JavaScript?
Map: Definition and Usage. map() creates a new array from calling a function for every array element. map() calls a function once for each element in an array. map() does not execute the function for empty elements. map() does not change the original array.
ForEach: The forEach() method calls a function and iterates over the elements of an array. The forEach() method can also be used on Maps and Sets.
Filter: The filter() method creates a new array filled with elements that pass a test provided by a function. The filter() method does not execute the function for empty elements. The filter() method does not change the original array.
Find: find() method in Javascript is used to get the value of the first element in the array that satisfies the provided condition. It checks all the elements of the array and whichever first element satisfies the condition is going to print.
Blog-4
Why we use Template strings?
Template strings are literals delimited with backtick (`) characters, allowing for multi-line strings, for string interpolation with embedded expressions, and for special constructs called tagged templates.
Template strings are sometimes informally called template strings, because they are used most commonly for string interpolation (to create strings by doing substitution of placeholders). However, a tagged template literal may not result in a string; it can be used with a custom tag function to perform whatever operations you want on the different parts of the template literal.