Explicit conversion ........developer use

var k = “20”;
var ans1 = number(k);
console.log(ans1,typeof(ans1));

var k = number(null);
console.log(k,typeof(k));

var k = number(true);
console.log(k,typeof(k))
i cant get out put why ?/?!..!!

1 Like

For this one you should use var ans1=Number(K), instead of number(k).

var k = “20”;
var ans1 = Number(k);
console.log(ans1,typeof(ans1));

var k = Number(null);
console.log(k,typeof(k));

var k = Number(true);
console.log(k,typeof(k))

It will work.

2 Likes