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

Friday, February 1, 2013

Codecademy: Getting Closer To String Translation



// Sample solution

// This is a dummy, to be refined later
function mapping(character) {
    if (character >= 'A' && character <= 'z') {
        return 'x';
    }
    else return character;
}

function substitute(string) {
    /* your code here */
    return string.split("").map(function(n){ return mapping(n); }).join("");
}

// Test your function:
// this should print   "xxxx xx xxxxxxxxxx!"
console.log(substitute("Make me unreadable!"));

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts