Here are some ways to convert a String to an Int in javascript:
var str = "123"; var num = parseInt(str);
var str = "123"; var num = Number(str);
var str = "123"; var num = +str;
var str = "123"; var num = str | 0;
Note: In above examples, if given input can not be converted to number then first three methods will return NaN and 4th will return 0.