Is it possible to have a Javascript variable to have two or more functions inside? -


i have following javascript code:

    var lab = {         minseat: function(){             var seat = 10;             return seat;         }           maxseat: function(){             var seat = 50;             return seat;         }       } 

so, when need value, call following code:

    console.log(" min seat: " + lab.minseat());     console.log(" max seat: " + lab.maxseat()); 

however, seems not working. so, may know if possible have javascript variable have 2 or more functions inside?

you forgot comma after first function:

var lab = {     minseat: function(){         var seat = 10;         return seat;     },      maxseat: function(){         var seat = 50;         return seat;     }   } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -