Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, December 17, 2012

Codecademy Sample Solution: Codeyear I Can Haz Negative?



var qty = 0;

function modify_qty(val) {
    var new_qty = qty + val;
    if(new_qty>=0){
    return new_qty;
    } else {
    return 0;
    }
}

//test
modify_qty(-12);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts