Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // true or false を返すfunction
- function checkMatch(key, element){
- return key == element;
- }
- // 上記の関数をfilterに使う場合
- // これだと動作する
- arr1 = collection.filter(function(element){
- return checkMatch(key, element);
- });
- // これだと動作しない return が抜けている
- arr2 = collection.filter(function(element){
- checkMatch(key, element);
- });
Add Comment
Please, Sign In to add comment