javascript - Changing array value from string to int jQuery -


how change value of array if i've got ["-2", -1, 0, 1, 2]. take data text box, need have array of int instead of 1 string @ begining. tried parseint(array) , eval(array) nothing working. thanks

unary + can used convert operand number:

array[0] = +array[0]; 

if want convert strings in array can use map:

array = array.map( number ); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -