A Promise is an object that represents the eventual completion (or failure) of an asynchronous operation, and its resulting value. Promise can either be fulfilled with a value, or rejected with a reason (error). A [ … ]
Tag: javascript
Handling Array of Objects in JavaScript
If you are working with APIs, most of the time you will encounter arrays of objects. In this article you will learn how array of objects should be handled for [ … ]
What is Callback in JavaScript
A callback is a plain JavaScript function passed to some other function as an argument or option. In JavaScript, functions are objects. Because of this, a function can take another function as a [ … ]
Remove Duplicates From Array in JavaScript
Here is a simple way to remove duplicate elements from an array in JavaScript. Just loop through the actual array and push each element in another temporary unique array. Before [ … ]
Trim All Whitespaces From String in JavaScript
JavaScript’s inbuilt method trim() removes whitespace from both ends of a string. The Syntax: str.trim() The method returns new string representing the str stripped of whitespace from both ends. Try yourself
Sort Array of Objects by Property Value in JavaScript
In this article I will discuss about how to sort array of objects by property or key value. Consider the following array of objects: Suppose you want to sort the [ … ]