There are several ways to find out.You can use inbuilt Array methods. The most prominently used is Array find method.
const arr1 = [1, 2, 3, 4, 5]const result = arr1.find(ele => ele === 4)console.log(result) //4const result2 = arr1.find(ele => ele === 6)console.log(result2) //undefined/* If the element is present inside the arraythen it will return the first element thatsatisfies the given condition. Otherwiseundefined will return.*/