Is It Possible To Have A Javascript Variable To Have Two Or More Functions Inside?
I have the following Javascript code: var Lab = { minseat: function(){ var seat = 10; return seat; } maxseat: function(){
Solution 1:
You forgot a comma after the first function:
varLab = {
minseat: function(){
var seat = 10;
return seat;
},
maxseat: function(){
var seat = 50;
return seat;
}
}
Solution 2:
How about a comma separating the keys in your object definition.
varLab = {
minseat: function(){
var seat = 10;
return seat;
},
maxseat: function(){
var seat = 50;
return seat;
}
}
Baca Juga
- How Can I Increase A Number By Activating A Button To Be Able To Access A Function Each Time The Button Is Increased?
- What Is Missing From This Description For Nested Functions And Closures At Mozilla Developer Network?
- In Javascript V8 Does Compilation Phase Happen To Functions Before Execution Phase Then All The Code Is Executed Or Only For Global Context
Post a Comment for "Is It Possible To Have A Javascript Variable To Have Two Or More Functions Inside?"