Tuesday, 23 September 2014

How to convert string to number or integer in js?

var str = "123";
alert(str+"---"+typeof(str));
str = Number(str);
alert(str+"---"+typeof(str));

No comments:

Post a Comment