Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the best way to convert a string into an integer in terms of readability / performance, best practices? And why?

- Number Constructor ? (ex : Number("");)

- parseInt ? (ex: parseInt("");)

- Plus operator ? (ex: +"";)

- Bitwise >> (right shift) ? (ex: "" >>0;)

- Multiple (force cast) ? (ex: "" *1;)

- Bitwise NOT ? (ex: ~~"";)

- parseInt with base argument ? (ex: parseInt("",))

- Bitwise OR ? (ex: "" |0;)

- minus0 ? (ex: "" -0;)

user-image
Question added by Jonathan de Flaugergues , software engineer , Abbeal
Date Posted: 2017/02/14
Amir Khan
by Amir Khan , LAMP/PHP Web Programmer , GTA Web Developers

parseInt .. for why you may google it please

More Questions Like This