title: Check if second string is rotation of another string
body: <p>I'm trying to write a function that takes in two string parameters and check if the second parameter is a rotated version of the first string. </p>
  
  <p>So the following would be the results:</p>
  
  <p><code>checkRotationStrings('waterbottle', 'lewaterbott'); // true</code>
  <code>checkRotationStrings('waterbottle', 'bottlewater'); // true</code>
  <code>checkRotationStrings('waterbottle', 'erbottlewat'); // true</code>
  <code>checkRotationStrings('waterbottle', 'lewaterbottx'); // false</code></p>
  
  <p>I wrote the following code, but there are some edge cases that I can't seem to figure out:</p>
  
  <pre class="lang-js prettyprint-override"><code>function checkRotationStrings(string, rotatedString) {
    let result;
    let rotationCheck
    let stringArr = string.split('');
    let rotatedStringArr = rotatedString.split('')
  
    for (let i = 0; i &lt; string.length - 1; i++) {
      if (rotatedString[0] === stringArr[i]) {
         result = stringArr.slice(i);
         rotationCheck = stringArr.slice(0, i).concat(result).join('');
      }
    }
    console.log(rotationCheck)
    if (rotationCheck === string){
      return true;
    } else {
      return false;
    }
  }
  </code></pre>
  
  <p>Any help would be appreciated.</p>