title: How to remove whitespace from a string in Cypress
body: <p>I'm trying to remove a whitespace from a numerical value representing money.</p>
  <p>For example, I want <code>1 000 kr</code> to be <code>1000</code>. This is the same case for when the currency is <code>10 000</code></p>
  <p>I'm using this function to remove the <code>kr</code> but when I try to add another <code>.replace</code> it does not work:</p>
  <pre><code>Cypress.Commands.add('currency', (selector) =&gt; {
        cy.get(selector)
          .children()
          .eq(1)
          .invoke('text') // get text
          .then((text) =&gt; +text.replace('kr', '').trim());
      });
  </code></pre>
  <p><strong>How would I add another .replace to remove the extra spacing from the numerical value?</strong> <a href="https://i.stack.imgur.com/wfAKf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wfAKf.png" alt="enter image description here" /></a></p>