Created
January 2, 2012 15:32
-
-
Save e-jigsaw/1551119 to your computer and use it in GitHub Desktop.
New year card coding!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = ["HOGE", "SOME", "TEXT", "IN", "HERE", "PIYO"]; | |
for(var t in str) { | |
var c = t + 2; | |
t = parseInt(t); | |
console.log(t+1); | |
for(var i in str[t]) { | |
var right = str[t].charCodeAt(i) + (t+1); | |
var left = str[t].charCodeAt(i) - (t+1); | |
if(right > 90) right -= 26; | |
if(left < 65) left += 26; | |
if(c <= (t+1)) console.log(String.fromCharCode(right + 32)); | |
else { | |
console.log(String.fromCharCode(left)); | |
c = 0; | |
} | |
c++; | |
} | |
console.log("------------------------"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment