hi all....
using javascript
i want to add 01+1 and my desired output is 02.
my code is
var t=01;
var t2=t+1;
alert(t2);
the alert value is 2.
I want 02....what will i do?
thanks in advance....
hi all....
using javascript
i want to add 01+1 and my desired output is 02.
my code is
var t=01;
var t2=t+1;
alert(t2);
the alert value is 2.
I want 02....what will i do?
thanks in advance....
Hi,
you can use
t2 = "0" + t2;
if you want to add 0 to only numbers less than 10 then
if(t2 < 10 )
{
t2 = "0" + t2;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.