title: In javascript how to add or remove 's' from a quantity string
body: <p>I have a string that's returned from the database such as <code>7 Months 5 Days</code>.</p>
  
  <p>The issue is when it's 1 Month 1 Day, it's still showing as <code>1 Months 1 Days</code>, notice the letter <code>s</code> in <code>Months</code> and <code>Days</code>.</p>
  
  <p>And I'm not allowed to use brackets like this <code>1 Month(s) 1 Day(s)</code>.</p>
  
  <p>Please how can I make a condition that if it's less than 2 Days then remove the <code>s</code>?</p>
  
  <p>The below is not working. What do I do?</p>
  
  <p>JS</p>
  
  <pre><code>var YYMM = '1 Months 1 Days'; // simulated data.
  
  if (YYMM.indexOf('1') &gt; -1) {
    YYMM.replace('s', '');
  
    console.log('YYMM is: ', YYMM);
  }
  </code></pre>
  
  <p>Many Thanks</p>