JavaScript is a functional programming language, and functions play a crucial role. They allow you to encapsulate reusable code and perform specific tasks. Here are some quick examples of functions that can make your life easier.
Regular function
Function expression
Arrow function
Generator function
Create an array of numbers from 1 to n.
Create an array of numbers from 1 to n with a step.
Create an array and fill it with a value.
Shuffling an array
Remove Duplicated from Array
Generate random number
Find largest numbers
Find smallest numbers
Pick a random element from an array.
Convert array to object
Find the intersection of two arrays.
Remove falsy values from an array.
Reverse String
Is String Palindrome
Check if the object is empty or not.
Find the number of days in a month.
Generate a random color
Check out the Javascript Quick Functions GitHub repo for more functions like this.