All Numbers in Array Are Prime

Published by julysfire in

Create a function that takes an array of integers and returns true if every number is prime. Otherwise, return false.

Examples

allPrime([7, 5, 2, 4, 6]) ➞ false

allPrime([2, 3, 5, 7, 13, 17, 19, 23, 29]) ➞ true

allPrime([1, 5, 3]) ➞ false

Notes

1 is not a prime number.

Watch a quick demo on how Edabit works.