Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Implementation of Linear Search

Set found to false
Set position to −1
Set index to 0
while found is false and index < number of elements
    if list[index] is equal to search value
        Set found to true
        Set position to index
    else Add 1 to index
return position
Source by code.tutsplus.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #Implementation #Linear #Search
ADD COMMENT
Topic
Name
9+6 =