I have the following code
var number = 0618260587
JSON.stringify(number)
the stringified result is 618260587 , the first zero is automatically truncated.
I tried the following fix
if(number.length<8)
{
var book1 = "0" + number;
alert(book1);
but it alerts undefined. I am not sure
1) Why the stringified data truncates the first zero 2) I thought javascript adds two variables irrespective of type