Logo

Programming-Idioms

History of Idiom 12 > diff from v4 to v5

Edit summary for version 5 by :

Version 4

2015-08-01, 16:30:58

Version 5

2015-08-01, 16:31:42

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is any iterable finite container.

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is any iterable finite container.

Code
list.indexOf(x)
Code
list.indexOf(x)
Comments bubble
Where list is an Array object
Comments bubble
Where list is an Array object. Result is -1 if the object doesn't exist, otherwise its index into the list.