Convert String to Number in Javascript


/ Published in: JavaScript
Save to your folder(s)

Javascript sometimes confuses strings and numbers. When this happens, you get bizarre outcomes such as "2 + 2 = 22". The following code FORCES a conversion to a number.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.