Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

linearSearch

const linearSearch = (list, item) => {
  for (let i = 0; i < list.length; i++) {
    console.log(`we are at ${i} and item ${list[i]}`);
    if (item === list[i]) return i;
  }
};

console.log(linearSearch([2, 6, 7, 90, 103, 11, 24], 90));
Comment

PREVIOUS NEXT
Code Example
Javascript :: Check for particular values in the response body 
Javascript :: lowest index 
Javascript :: nested destructuring in javascript 
Javascript :: random bigint javascript 
Javascript :: regex match but ignore part 
Javascript :: FTP Get a directory listing of the current 
Javascript :: javascript list all declared variables 
Javascript :: assignment of struct in solidity 
Javascript :: convert promise to generator js 
Javascript :: falsy value in javascript 
Javascript :: replace then replace back 
Javascript :: how to input struct into parameter in remix 
Javascript :: node.js sign in to website and get contents of new page 
Javascript :: Declaring Variables Shorthand javascript 
Javascript :: NestJs starter repo 
Javascript :: paramters and arguments 
Javascript :: ASPxGridView - How to trigger the CustomButtonCallback event 
Javascript :: on scroll image blur jquery 
Javascript :: how to add multiple quill rich text editor 
Javascript :: Filters in Algolia search 
Javascript :: hook redux state with redux extension 
Javascript :: fiffo in javascript 
Javascript :: openapi 3 json and file 400 
Javascript :: js wrap a function pass parameters to function 
Javascript :: typeorm caching queries time limit 
Javascript :: response conditions 
Javascript :: Quitar objetos duplicados 
Javascript :: how to customize reactnative view dropshadow 
Javascript :: subject in angular service file 
Javascript :: add value get value 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =