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

Monday, December 17, 2012

Codecademy Sample Solution: Codeyear Strings and Numbers



// sample solution to script.js

function modify_qty(val) {
    var qty = parseInt(document.getElementById('qty').value);
    var new_qty = qty + val;
   
    if (new_qty < 0) {
        new_qty = 0;
    }
   
    document.getElementById('qty').value = new_qty;
    return new_qty;
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts