Skip to content
Advertisement

Covert ForLoop to ForEach in Javascript

I was practicing in Hackerrank JavaScript problems. I found one test which is called Compare the triplets. This is the problem:

JavaScript

I found the solution like this:

JavaScript

I wanted to convert the ForLoop into ForEach method. But I could not find the way to do that.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement