title: how can i put a period at the end of a formated text
body: <p>hi this is my first question, sorry if it is stupid but i stumble upon this code </p>
  
  <pre><code>function format(input){
    var num = input.value.replace(/\./g,'');
    if(!isNaN(num)){
      num = num.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{1})/g,'$1.');
      num = num.split('').reverse().join('').replace(/^[\.]/,'');
      input.value = num;
    }
  
    else{ alert('just numeric values please');
      input.value = input.value.replace(/[^\d\.]*/g,'');
    }
  }
  </code></pre>
  
  <p>i don't really understand how it works, but basically it formats an input in real time to this format "9.9.9.9.9" but i want it to have it like this "9.9.9.9.9.". How can i add that last period?
  thanks beforehand </p>