Skip to content

Instantly share code, notes, and snippets.

@mapiondev
Created June 8, 2010 00:38
Show Gist options
  • Save mapiondev/429435 to your computer and use it in GitHub Desktop.
Save mapiondev/429435 to your computer and use it in GitHub Desktop.
[javascript] クロージャ2
function baisu(a, b) {
var closure = function(x) {
return (x % a == 0 && x % b == 0);
};
return closure;
}
function check(list, func) {
for (var i = 0; i < list.length; i++) {
if (func(list[i])) {
console.log(list[i]);
}
}
}
check([1, 15, 30, 40], baisu(3, 5));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment