Traditional programming languages had generics for a long time. Microsoft introduced generics in C# in 2005; Java also has generics. JavaScript itself does not have any explicit concept of generics but TypeScript does.
Generics, in layman's terms, is a concept that allows developers to define functions or classes without explicitly defining the types that the said function or class expects but rather allowing a generic definition, which would then be consumed by the calling functions as they see fit.
We have been using generics in our last application and we will be using it again, extensively, in our current application.
Generics allow us to create reusable and consistent component definitions. For example, we can have a function that accepts a string or a number and adds it to a collection.
So, we can either define two functions, each with their parameter...