views:

122

answers:

1

Hi,

I have been using mootools for a year now. I need to use jquery for my new projects.

I always used hash() to make namespaces for my functions in mootools. For example,

var person = new Hash({
    say_name: function(){

    },
    say_age: function(){

    } 
});

Does Jquery has similar stuff?

+1  A: 

I don't think there is.

But you can just do

var person = {
    say_name: function() {
        ...
    },
    say_age: function(){
        ....
    } 
};
//and access like this
person.say_name();

The only difference is that the "convenience" functions provided by motools-Hash will be missing but the "namespace" effect is there.

And to be honest, after a quick look at the motools hash documentation, I bet you could reimplement most of the functions motools-Hash provides in a couple of minutes

jitter
what, like doing object prototyping in few minutes? if you only use hash to get object keys (for instance) then you are missing the point and probably don't appreciate how awesome it is...
Dimitar Christoff