How to Extract Numbers From A String In JavaScript

Including decimals, negatives, and numbers with commas

While working on certain tasks with JavaScript, we might need to extract specific data from a string, such as uppercase words or numbers. In this post, I am going to address numbers. The numbers may also be: decimal - examples: average, price, score negative - examples: temperature, mathematical calculations comma separated - example: large amount such as appear in telephone numbers or bank statement Or a combination of any of these. [Read More]

JavaScript Inheritance And Polymorphism In React JS Application

The React JS documentation emphasizes on using composition over inheritance for components, as there is hardly any scenario that requires component inheritance. However, that does not stop us from using inheritance and polymorphism within our JavaScript code. To explain, we discuss one such example below by using es6 classes: [Read More]

What Are The Use Cases of Lodash Chunk method?

Chunk is a method of Lodash that splits the array into evenly sized arrays and returns them in a single array. If the array is indivisible evenly, the final chunk has the left over elements. It takes the size of the grouping in argument (the default size is 1). [Read More]

JavaScript Flatten Deeply Nested Array of Objects Into Single Level Array

Using plain JavaScript, and lodash's flatMapDeep method

Requirement: We have an array of objects that is deeply nested. We want to bring all the nested objects into the array at root level. Following is the example array familyTree that has multiple people in the root and many of them have children array containing further members: [Read More]