100.0% Acceptance

In this coding challenge, you will be implementing a function called isInArray(array, value) that takes two arguments: an array and a value. The function should return true if the input array includes the value and false otherwise


  • If the input array is empty, return false.
  • Assume that the input array will not contain objects.

Example test cases

const fruits = ['apple', 'banana', 'orange']; isInArray(fruits, 'banana'); // Output: true isInArray(fruits, 'pear'); // Output: false


  • You can use the built-in method .includes() directly on the input array.
  • Alternatively, you can write a for loop that iterates over every element of the array. For each element check if it’s equal to value.