Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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 ajoutée par Jonathan de Flaugergues , software engineer , Abbeal
Date de publication: 2017/02/14
Amir Khan
par Amir Khan , LAMP/PHP Web Programmer , GTA Web Developers

parseInt .. for why you may google it please

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?