oops I meant $merge.

merge works recursively on objects. $extend doesn't.

newMergedObject = $merge(obj1,obj2,obj3,....);

On Sun, Jan 11, 2009 at 5:41 PM, nwhite <[email protected]> wrote:

> you can also use $extend()
>
> newMergedObject = $extend(obj1,obj2,obj3,....);
>
>
>
> On Sun, Jan 11, 2009 at 5:25 PM, Sanford Whiteman <
> [email protected]> wrote:
>
>>
>> > now, how would I combine objects? Sorry... I'm very new to all of this
>> > and can't seem to find the answers when searching on my own.
>>
>> var myObj = new Hash({min: 'blah', max: 'blah', bet: 'blah'});
>> var myObj2 = new Hash({plus: 'bloo'});
>> var setJSON = JSON.encode(myObj.combine(myObj2));
>>
>> Note  that myObj2 does not really have to be a Hash, as combine() will
>> accept  a  native  Object as well as long as the base (the var you are
>> adding  *to*)  is a Hash. But for completeness, I think you should use
>> Hash all around.
>>
>> That's  all  for  now...  you  should  read  through the Hash docs for
>> starters.
>>
>> --Sandy
>>
>>
>

Reply via email to