JSB

intval

Retourne la valeur numérique entière équivalente d'une variable.

À l'inverse de la fonction native parseInt, en cas d'échec, $.intval renvoie 0.

var a=$.intval("34"); // Retourne 34
a=$.intval("4rt56"); // Retourne 4
a=$.intval(56.998); // Retourne 56
a=$.intval([56]); // Retourne 56
a=$.intval('foo'); // Retourne 0
a=$.intval({a:13}); // Retourne 0

Voir aussi : $.floatval

© BM | www.selfbuild.fr