You are here: DEVPPL Forum Programming JavaScript Forum
NOTIFICATIONS
54.334
MEMBERS
15.720
TOPICS
62.409
POSTS
  562
FLASH GAMES
7.740
TUTORIALS
 

Login

E-mail:
Password:

IF statement - Number format

0

Loading

IF statement - Number format

Postby Alibzafar » Wed Apr 27, 2011 2: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
 
Reputation: 0
Posts: 1
Joined: Wed Apr 27, 2011 1:51 pm
Highscores: 0
Arcade winning challenges: 0

IF statement - Number format - Sponsored results

Sponsored results

Login to get rid of ads

 

0

Loading

Re: IF statement - Number format

Postby Rajmv » Sun Jul 17, 2011 5:44 pm

parseFloat(input) is your friend
Rajmv
 
Reputation: 0
Posts: 103
Joined: Thu Jul 14, 2011 8:22 am
Highscores: 0
Arcade winning challenges: 0
^ Back to Top