Method 1 – Using For Loop
Sometimes you may like to use older ways that is easy to use. This is simple c programming like for loop, easy to use and works perfect.
Method 2 – Using forEach
The forEach function calls callbackfn function one time for each element present in the array, in ascending index order. This is also useful for navigating through an array.