title: convert string to a number in javascript
body: <p>I want to parse a user input which contains longitude and latitude. What I want to do is to coerce a string to a number, preserving its sign and decimal places. But what I want to do is to display a message when user's input is invalid. Which one should I follow</p>
  
  <pre><code>parseFloat(x)
  </code></pre>
  
  <p>second</p>
  
  <pre><code>new Number(x)
  </code></pre>
  
  <p>third</p>
  
  <pre><code>~~x
  </code></pre>
  
  <p>fourth</p>
  
  <pre><code>+x
  </code></pre>