JSFiddle - React, Tailwind, and code Playground

by manoj_antony32

HTML

<p>Rotate the String.</p>
<input type="string" name="word" id="word" onkeyup='changeValue()' />
<button type="button" onclick="myFunction()">Rotate</button>
<p id="demo"></p>

JavaScript

var rotateWord = null;
function changeValue(){
rotateWord=document.getElementById("word").value;
}
function executeMe () {
  function get(){
       rotateWord=rotateWord.slice(-1)+rotateWord.slice(0,-1);
   }
   get();
   return rotateWord;
 };

function myFunction(){
  document.getElementById("demo").innerHTML = executeMe();
}