tks Tobie,
  I'm new to javascript and prototype framework, I will use Object.extend:

tks

Tobie Langel escreveu:
Hi  Fernando,

why don't you just use Object.extend:

var v1  = {
                  a: 'value for a',
                  b:'value for b'
               };

var v2  = {
                   c: 'value for c',
                   d: function(){some code...}
               };

var v3 = Object.extend(v1, v2);

This will preserve your function.

regards,

Tobie

On 10 juil. 2006, at 16:03, [EMAIL PROTECTED] wrote:

From: "Siegfried Puchbauer" <[EMAIL PROTECTED]>
Subject: Re: [Rails-spinoffs] prototype hash method
To: rails-spinoffs@lists.rubyonrails.org
Message-ID:
    <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

try it this way:

var v1 = { a: 'value for a', b:'value for b' };
var v2 = { c: 'value for c', d: function(){} };
var v3 = $H(v2).merge($H(v1));

v3.inspect();
// #<Hash:{'c': 'value for c', 'a': 'value for a', 'b': 'value for b'}>

but v2.d will be ignored (type of the value is function)

hth

sigi

On 7/10/06, Fernando <[EMAIL PROTECTED]> wrote:

var v1  = {
                  a: 'value for a',
                  b:'value for b'
               }

var v2  = {
                   c: 'value for c',
                   d: function(){some code...}
               };

var v3 = v2.merge(v1);
I'm getting an error doing this...

what is wrong?
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to