It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

IF statement - Number format

IF statement - Number format

Postby alibzafar on Wed Apr 27, 2011 1:00 pm

I am having input in number format or normal string , I have to write a code in JS where if input is number it changes its format, for instance 315.0(input) it should convert to 315(output) , otherwise if input is 315A(input) it should return same output (315A).

Here's a piece of my code but it doesn't work

if (input != 000.0) {
output = input;
} else {
output = 000;
}

Thanks
Ali
alibzafar
 
Posts: 1
Joined: Wed Apr 27, 2011 12:51 pm

Re: IF statement - Number format

Postby rajmv on Sun Jul 17, 2011 4:44 pm

parseFloat(input) is your friend
rajmv
100+ Club
 
Posts: 103
Joined: Thu Jul 14, 2011 7:22 am


Who is online

Users browsing this forum: No registered users and 5 guests

cron