check every item in loop before returning

Instead of an else statement inside for loop, put that outside of loop if loop does not return.

for (let i = 0; i <= 5; i++) { if (i % 2 === 0) return true; } return false;

Comments

Popular posts from this blog

Code Wars: Data Reverse (6 kyu)

Code Wars: longest_palindrome (6 kyu)

Code Wars: Find the odd int