I was given an array with different numbers, and I was asked to write a function that returns the numbers from that array that are divisible by 3.
Anonymous
I was not required to write the exact function, just explained the logic. I used a for loop that iterates through the numbers. Use an 'if' statement to check if the remainder of the number divided by 3 is zero. If yes, I added it to a result array and printed the result array in the end.
Check out your Company Bowl for anonymous work chats.