Remove Characters One By One (Closure Example)

<html>
<body class="someClass">
<input type="button" onclick="pp()" value="click me">
<input type="text" id="jj" value="Prashant">
</body>
</html>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">


var pp=(function(){
var name=$("#jj").val();
var stringlength=name.length;

return function(){
var newString='';
for(i=0;i<stringlength;i++){
newString=newString+name[i];
}
stringlength--;
$("#jj").val(newString);
}

})();
</script>