OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

What does the unary plus operator do in JavaScript?

  • Thread starter Thread starter chills42
  • Start date Start date
C

chills42

Guest
While looking at the jslint code conventions I saw this line:

Code:
total = subtotal + (+myInput.value);

What is the purpose of the second '+'?

<p>While looking at the <a href="http://javascript.crockford.com/code.html" rel="noreferrer">jslint code conventions</a> I saw this line:</p>

<pre><code>total = subtotal + (+myInput.value);
</code></pre>

<p>What is the purpose of the second '+'?</p>
 

Latest posts

Top