Skip to content

Instantly share code, notes, and snippets.

@mootrichard
Created January 22, 2015 22:23
Show Gist options
  • Save mootrichard/7608479e2855875d6d67 to your computer and use it in GitHub Desktop.
Save mootrichard/7608479e2855875d6d67 to your computer and use it in GitHub Desktop.
// Phase 1
var decryptA = function(message){
var temp = message.split(" "),
i = 0,
result = [];
for(i = 0;i < temp.length;i++){
result.push(temp[i].slice(temp[i].length - 1))
}
result = result.join("");
return result;
};
// Phase 2
var decryptB = function (message){
var temp = message.split(" "),
i = 0,
result = [];
for(i = 0;i < temp.length;i++){
if (temp[i].slice(0,1) > temp[i].slice(temp[i].length - 1)){
result.push(temp[i].slice(0,1));
}
else{
result.push(temp[i].slice(temp[i].length - 1));
}
}
result = result.join("");
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment