Guest User

Untitled

a guest
May 27th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // mapion.js
  2. // クロージャ
  3. function baisu(a, b) {
  4. var closure = function(x) {
  5. return (x % a == 0 && x % b == 0);
  6. };
  7. return closure;
  8. }
  9.  
  10. function check(list, func) {
  11. for (var i = 0; i < list.length; i++) {
  12. if (func(list[i])) {
  13. console.log(list[i]);
  14. }
  15. }
  16. }
  17.  
  18. check([1, 15, 30, 40], baisu(3, 5));
Add Comment
Please, Sign In to add comment