javascript - How can I convert a string(1,234) into a number(1234) using script? -


there several ways convert string integer, when string ex:"1,234",

parseint("1,234")  

is converted number o/p : 1. there way number 1234 when enter string "1,234". please suggest me number. in advance.

with variable

var tempnum="1,234"; parseint(tempnum.replace(/,/g,"")); 

without variable

parseint("1,234".replace(/,/g,"")); 

reference replace


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -