Tuesday, July 1, 2014

how to convert var into numeric in javascript

var test1 = new Boolean(true);
var test2 = new Boolean(false);
var test3 = new Date();
var test4 = new String("999");
var test5 = new String("999 888");

var n = Number(test1) + "<br>" + Number(test2) + "<br>" + Number(test3) + "<br>" + Number(test4) + "<br>" + Number(test5);


1
0
1382704503079
999
NaN

No comments:

Post a Comment