INTRODUCTION : I have a function(callback) that receives a object as an argument, inside this function I have a method(or function I'm note sure what is it) which then partitions that object. Now I'll add some code to add some clarification to introduction part.
Result.getListCallback = function(obj) {
Result.complexObject = obj.data;
var objectPartitioner = Result.complexObject.partition( function(n){
return n.case.id == Result.selectedData.case.id;
});
}
What I want to do is to modify this "objectPartitioner" to return couple of things for me not just case.id , how can I do that , perhaps using several return开发者_如何学编程s ? thank you
Why not return an object? In this case, you can pack what you want.
Note that if you want to return something like a small array it is anyhow an object in Javascript.
Unfortunately, the only way to do this is to return a list, and if you're going to do that, you're better off returning an object that has mnemonics for variable names. Javascript objects are really just overblown arrays.
This is one of the great things I love about perl, you can return lists of values with names from your functions.
精彩评论