Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created September 20, 2015 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/1fe06f54028647fb10e1 to your computer and use it in GitHub Desktop.
Save chuck0523/1fe06f54028647fb10e1 to your computer and use it in GitHub Desktop.
"use strict";
var log = function log(x) {
console.log(x);
};
var ary = [10, 23, 4, 0, 77];
var even = function(x) {
return x % 2 === 0;
};
var over20 = function(x) {
return x > 20;
};
var a = ary.filter(even);
log(a); // [ 10, 4, 0 ]
var b = ary.filter(over20);
log(b); // [ 23, 77 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment