Check if Array Contains Number

ARRAY

Problem

Given an array of integers array and an integer num, return true if num is an element in array, and false otherwise.

Examples

arrayContainsNumber([1, 2, 3, 4, 5], 3) // true arrayContainsNumber([10, 20, 30, 40, 50], 25) // false arrayContainsNumber([7, 14, 21, 28], 21) // true arrayContainsNumber([], 42) // false
Loading...