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
Post a Comment