Solutions Log

So I only have to figure things out once.

Optional Parameters in JavaScript Functions

Set it up
1
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 it
1
app.adjustDisplay('smooth');

JavaScript

Comments