var s = '10'; var n = Number(s); //10 console.log(n); s = '10d'; n = Number(s); //NaN console.log(n); var d = new Date("December 30, 2022 08:08:00"); console.log(Number(d)); //1672358880000 var n = 100; console.log(n.toFixed(2)); //100.00 n=123456; console.log(n.toLocaleString()); //123,456 var n=12345678; console.log(n.toExponential(2)); // 1.23e+7 n=12345678; console.log(n.toPrecision(2)); // 1.2e+7