Search for a number in an array using javascript

//Search for an number in given array
 const arraySearch = (num, arr) => {
     for(let i =0; i <= arr.length; i++) {
         if(num === arr[i])
             return i;
     }
     return -1;
 }
 console.log(arraySearch(5, [4, 7, 5, 6, 3, 9, 6])); //2
 console.log(arraySearch(25, [10, 90, 20, 30, 40])); // -1
 console.log(arraySearch(40, [10, 90, 20, 30, 40])); // 4