Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mapion.js
- // クロージャ
- 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));
Add Comment
Please, Sign In to add comment