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

Friday, December 16, 2016

Codefights increaseNumberRoundness(n)


//sample solution
function increaseNumberRoundness(n) {
    var nArrayed = n.toString().split("").reverse();
    //document.writeln("nArrayed: ", nArrayed, "<br/>");
    //document.writeln("nArrayed length: ", nArrayed.length, "<br/>");
    var nonZeroPassed=false;
    var returnValue = false;
    for(i=0;i<nArrayed.length;i++){
    var temp = nArrayed[i];
        //document.writeln("temp: ", temp, "<br/>");
        if(parseInt(temp)!=0){
        nonZeroPassed=true;
        }
        if(parseInt(temp)==0 && nonZeroPassed){
        returnValue = true;
        }
    }
    return returnValue;
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts