Created
March 19, 2014 20:27
-
-
Save jayzeng/9650477 to your computer and use it in GitHub Desktop.
left shifting
This file contains hidden or 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
function shift(input, pos) { | |
return input.slice(pos, input.length) + input.slice(0, pos); | |
} | |
console.log(shift("abcdefg", 2) === "cdefgab"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment