Generate test functions using the RegExp prototype.

  var testForA = RegExp.prototype.test.bind(/[aA]/);
  // function () { [native code] }

  testForA('hello');
  // false

  testForA('hella');
  // true

  ['hello', 'hella', 'holla'].filter(testForA);
  // ['hella', 'holla']

Oh the lengths we'll go to avoid typing 'function'

Jonathan D. Johnson

professional πŸ’»β”†amateur πŸ§—πŸ»β€β™‚οΈβ”†health β“₯

codeship by day 🚒
packtracker.io by night πŸ“¦
#dadlife in between πŸ‘¨β€πŸ‘©β€πŸ‘¦β€πŸ‘¦