Really simple - how to get a reference

Jul 15, 2013 at 1:05 PM
Edited Jul 15, 2013 at 2:13 PM
SORRY - SOLVED. It does work, I just confuzzled myself for a minute.

Hi, I want to change an object via a linqjs query.
Ideally, I would do this by setting the value of the fetched object (like pass-by-reference)...but any solutions will be an improvement.
Thanks.

EXAMPLE:
I have two simple arrays:
Places:
[id=1, title="london"]
[id=2, title="tokyo"]
[id=3, title="bigben"]
[id=4, title="Japan"]

Places_Places:
[parentId=1, childId=3]
[parentId=4, childId=2]
I select "Japan's" children like this:
var japansChildren = Enumerable.From(Places)
    .Join(Places_Places, "$.id", "$.parentId", function (p, p_p){return p}) 
    .Where(function (x) { return x.title == "japan"; });
This will return [id=2, title="tokyo"],

Now I want to set "tokyo" to "venice":
japansChildren [0].title = "changed";
Or
test.ForEach(function(value, index){
    value.title = "changed";
});
Thank you for your help.