Search posts, tags, users, and pages
Yuvaraj
Software Developer
In this article, we are going to learn why we should use Array.some instead of Array.forEach (or) for loop. Objective In a given array, find if the student failed in any one of the subjects. The pass criteria for students is to score at least 40 ma...
Sujeet Agrahari
Building efficient backend systems, one move at a time!
As Array.some() will check if student failed in at least one subject, there is Array.every() which will check if he failed in all the subjects. BTW, Nice article.๐
Array.some()
Array.every()
Thank you. Yes, I'll cover Array.every in a separate article.
If we use Array.every in this scenario, then it will continue checking the remaining subjects as well. (i.e Social).
Pushpa Shahapure
Software Engineer
Very useful.must use to improve performance of application.
Yes, it improves the performance and readability of code. Thank you, Pushpa Shahapure ๐
Catalin Pit
Interesting approach, nice! I didn't think of it. ๐ฌ
Thank you. Happy to see your comment in my blog, Catalin Pit ๐
Sujeet Agrahari
Building efficient backend systems, one move at a time!
As
Array.some()will check if student failed in at least one subject, there isArray.every()which will check if he failed in all the subjects. BTW, Nice article.๐