Any number, it’s number. String looks like a number, it’s number. Everything else, it goes NaN.
'a' => NaN
'1' => 1
1 => 1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are 4 ways to do it as far as I know.
By this quick test I made, it actually depends on browsers.
https://jsben.ch/NnBKM
Implicitmarked the fastest on 3 browsers, but it makes the code hard to read… So choose whatever you feel like it!