Online JavaScript Compiler
function linearSearch(element, array) { for (const data of array) { if (data === element) { return 1; } } return -1; } console.log("element found if 1 else -1: ",linearSearch(5,[1,2,3,4,5])) //write rest of the code here
Run