Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Created January 3, 2016 20:22
Show Gist options
  • Save vlad-bezden/74f4c593d4a1487d29aa to your computer and use it in GitHub Desktop.
Save vlad-bezden/74f4c593d4a1487d29aa to your computer and use it in GitHub Desktop.
Some
'use strict';
let bar = ['bar', 'baz', 'qux'],
foo = ['foo', 'baz', 'qux'],
/**
* Check if a given context (this) contains the value
* @param {*} val
* @return {Boolean}
*/
compare = function(val) {
return this.indexOf(val) !== -1;
};
console.log(bar.some(compare, foo));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment