You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Searching/Linear Search/README.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,11 @@
5
5

6
6
7
7
8
-
#### Python Implementation
8
+
#### JavaScript Implementation
9
9
10
-
Though it is very easy in python to check for [an item's existence in a list](http://stackoverflow.com/a/7571665/4230330) by:
10
+
Though it is very easy in JavaScript to find index of an itemin a list using [indexOf method](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?v=example):
11
11
12
-
`item in list`
13
-
14
-
and [finding an item's index](http://stackoverflow.com/a/176921/4230330) by:
15
-
16
-
`list.index(item)`
12
+
`list.indexOf(item)`
17
13
18
14
but sometimes you might need to do some customization on the searching algorithm. Like- *'finding the last occurrence of the item in the list'* etc. This linear search implementation will help you to do that.
0 commit comments