diff --git a/solution.js b/solution.js index c8ce545..e21c028 100644 --- a/solution.js +++ b/solution.js @@ -2,7 +2,24 @@ Solution = (function() { return { isRotation: function(str1, str2) { //your solution goes here - throw 'missing implementation'; - } + if (str1.length != str2.length) + return false + + var rotatedStr = str1 + for (i = 0; i < str1.length; i++) { + if (rotatedStr == str2) + return true + + rotatedStr = rotateLeft(rotatedStr) + + } + + return false + } + + rotateLeft: function(str) { + var firstChar = str.charAt(0) + return str.substring(1) + firstChar + } } -}()); \ No newline at end of file +}());