//convert a string to integer s = "12"; i = parseInt(s, 10); //or you can do like this i = eval(s) //or you can do like this i = s − 0;