Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

contains

oatkiller edited this page Sep 13, 2010 · 3 revisions

contains returns true if the array contains the passed arguments

(function () {
	
[1,2,3][o.contains](1); // true. the array [1,2,3] has 1 as an element
[1,2,3,4][o.contains](0); // false, 0 isnt one of the elements of the array
[1,2,3,4][o.contains](1,2); // true. contains can take multiple params
[1,2,3,4][o.contains](0,1); // false. all params must be elements
['1',2,3][o.contains](1); // false. i always use === to compare.

})();
Clone this wiki locally