Optional Parameters in JavaScript Functions
Set it up1
2
3
4
5
6
7
8
9
10
| adjustDisplay: function(smooth){
if (smooth === undefined) { smooth = false };
...
if (smooth) {
$('#content').animate({height: '500px'}, 200);
} else {
$('#content').css('height', '500px');
};
},
...
|
Call it1
| app.adjustDisplay('smooth');
|