Create a function that takes an array of numbers and return "Boom!" if the number 7 appears in the array. Otherwise, return "there is no 7 in the array".
function sevenBoom(arr) {
if (arr.includes(7)) {
return "Boom!"
}
return "there is no 7 in the array"
}
TESTS
Test.assertEquals(sevenBoom([2, 6, 7, 9, 3]), "Boom!")
Test.assertEquals(sevenBoom([33, 68, 400, 5]), "there is no 7 in the array")
Test.assertEquals(sevenBoom([86, 48, 100, 66]), "there is no 7 in the array")
Test.assertEquals(sevenBoom([76, 55, 44, 32]), "Boom!")
Test.assertEquals(sevenBoom([35, 4, 9, 37]), "Boom!")
The last 2 tests are failing, im assuming that is the case because it's looking for a 7, not just having a 7 in the number itself.
How could I correct this?
NOT A DUPLICATE
This has nothing to do with substrings or strings. Why do people like marking things as duplicate so much?