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

Thursday, November 15, 2012

Codecademy: "Getting The Width"



//Sample solution for script.js

//Note: code exists prior to this point
function percentToWidth(percent,maxWidth) {
    var out = (percent/100)*maxWidth;
    if(isNaN(percent)){
    return 0;
    } else if(percent<0) {
    return 0;
    } else if(percent>100){
    return maxWidth;
    } else {
    return out;
    }
}
//Note: code exists after to this point

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts