Checking for the existence

Report a typo

You have an array of digits:

const digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

In the code below an element is given to the check() function. Change it so that the function checks if the element exists in the array and returns true or false.

Sample Input 1:

5

Sample Output 1:

true
Write a program in JavaScript
const digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

function check(element) {
// Write your code here
}
___

Create a free account to access the full topic