title: How to Add space between every 4 characters in JavaScript?
body: <p>I want to add a space between every 4 characters. I'm developing a webpage about credit card numbers.</p>
  
  <p>example</p>
  
  <pre><code>var x = document.getElementById("card_number").value;
  </code></pre>
  
  <p><strong>example :</strong> 
  if the value of x is 1234567890123456</p>
  
  <p>I need to split this number every 4 characters and add a space. Like this</p>
  
  <p><strong>1234 5678 9012 3456</strong></p>
  
  <p>and I need this number on a <strong>variable</strong>. Because I need to set this number on the textbox. 
  Please help me. thanks</p>