Here it is as a one-liner that I use often to merge a set of options with a default:

options = Object.extend(Object.extend({}, _defaultOptions), options);

_defaultOptions =  your defaults
options = passed in options and then the merged options

Brandon


On 7/10/06, Sam <[EMAIL PROTECTED]> wrote:
Sam wrote:
> Is it easy to explain the difference between a hash
>
> var myHash = {a: 'value for a'}
>
> and an object
>
> var myObject = {a: 'value for a'}

There is no difference between those. They are both associative arrays
(hashes).
---------------------------------------------------

Since prototype.js has Object and Hash methods, maybe my question should
have been something like:  "What is the reasoning behind why prototype
offers different properties and methods for Hash and Object types?"

Sam





_______________________________________________
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