namespace UsingFilter { function filter < T > ( items , pred ) { let result = [ ] ; for ( let item of items ) { if ( pred ( item ) ) { result . push ( item ) ; } } return result ; } let numbers = [ 1 , 2 , 3 , 4 , 5 ] ; let evens = filter ( numbers , ( item ) => item % 2 == 0 ) ; let strings = [ "apple" , "orange" , "peach" ] ; let length5Strings = filter ( strings , ( item ) => item . length == 5 ) ; }