![]() Topic awaiting preservation: parseInt (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: NZ |
![]() Q: What is the purpose of using parseInt? Let me explain. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Ah, yes. Well, NaN stands for Not a Number, which means "I couldn't get a number out of this string." You can't safely omit the parseInt, however, because something like this: code: var userinput = parseInt(form.input.value);
code: var userinput = parseInt(form.input.value);
|
Paranoid (IV) Inmate From: NZ |
![]() Hi, Slime. quote:
code: var userinput = parseInt(form.input.value);
|
Paranoid (IV) Inmate From: NZ |
![]() Yeah, I don't need {}. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Yup, { } is optional for if's, else's, while's, for's, and pretty much everything except for switch's and function's when there's only one statement inside of it. |
Bipolar (III) Inmate From: Belgium |
![]() Don't forget the function parseInt() has two arguments! |