JS functions that I learned this week

Shiva Aryal - Mar 11 '22 - - Dev Community

Today is friday and it’s the end of the week. Here are the top 5 javascript functions that I learned this week.

  • reduce() - Reduce function applied to arrays in Javascript. it takes the values in an array, from the first till the last element, and applies functionality such that it changes the array into one singular value. Hence, it reduces the array.

  • for…of iterator - the for-of iterator is similar to for loop. The for...of statement loops/iterates through the collection, and provides you the ability to modify specific items.

  • Nullish Operator - If the left hand side value is null or undefined this operator returns the right-hand side value otherwise left hand side value.for example: const value= null ?? “Hello”;

  • Spread Operator - Spread operator helps to expand the array into individual elements. So, it can be used to expand the array in a place where zero or more elements are expected.

  • Object.entries() - The Object.entries() method returns an array of a given object's own enumerable string-keyed property [key, value] pairs. This is the same as iterating with a for...in loop, except that a for...in loop enumerates properties in the prototype chain as well.

Please share what you learned this week in the comments. Let's learn together :)
#happyCoding #javascript #beginners

. . . . . . . . . .
Terabox Video Player