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
Post a Comment