how do i test this function in javascript
function breakup(list,partitioner) { var result = {}; for(var i=0; i var prop=partitioner(list[i]); if(!Array.isArray(result[prop])) { result[prop] = []; } result[prop].push(list[i]); } return result;}
This function accepts two inputs: a list of elements and a function that accepts an element from the list. The result is an object whose properties correspond to the items returned by the partitioner and whose values are lists of elements that generated that property.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here