Skip to content

Instantly share code, notes, and snippets.

@z-------------
Last active August 29, 2015 13:58
Show Gist options
  • Save z-------------/10014252 to your computer and use it in GitHub Desktop.
Save z-------------/10014252 to your computer and use it in GitHub Desktop.
Adds an Array function to test if an array contains a particular value
Array.prototype.contains = function(q){if(this.indexOf(q) != -1){return true}else{return false}}
//["waffles",3.14,"pie"].contains(3.14) --> true
//["waffles",3.14,"pie"].contains("foo") --> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment