0

I'm new in javascript.

I want to what's the difference between this

 function aa(){
    //code
}

    function bb(){
      //code
    }

and this

var b = {
        aa : function (){
    //code
      },
       bb: function () {
        //code
   }
};

I know about function. but I don't know about the another one.

What's it called and what's differences?? which one is better and faster??

Thanks in advance.

4

1 に答える 1

1

The first one creates two named functions: aa and bb.

The second one creates an object called b that has two properties: aa and bb, both of which have anonymous functions as values.

They do different things, so you can't really say which one is "better".

于 2013-03-18T06:57:54.000 に答える