alright is you want to perform search algorithm in one line well my friend you will need search-ray npm library
Steps : You will need NodeJS installed on your pc if you have then skip this step
Now install library using npm
npm install search-ray
create on simple folder and file named anything you like, copy below code init and run that JS files to get Output!
1] for linear search
const search = require('search-ray'); console.log(search.linearSearch([1,2,3,5],5)) // 
2] for Binary search
const search = require('search-ray'); console.log(search.binarySearch([1,2,3,5],5)) // 3
and thats it my friend thanks..
follow me for such tutorials!