0

Parseint()

a='2'; c=parseint(a,10); document.write(c); what output c ?

26th Feb 2017, 5:36 AM
フェリー
フェリー - avatar
7 ответов
+ 2
10 is to indicate what base is the value, in this case it is decimal number. Other example is 16, this is to indicate that the value would be in hexadecimal.
26th Feb 2017, 6:32 AM
Deddy Tandean
+ 2
There is an error because 'parseint' is not defined ( you must write 'parseInt' -- JS, like almost languages, is case sensitive ^^ )... But missing 'var' keyword raise an error only in JS 'strict' mode... what you should explicitly activate ;)
26th Feb 2017, 11:03 AM
visph
visph - avatar
+ 1
Error no output. Unless the code is: var a = '2'; var c = parseInt(a,10); document.write(c); Then the output is 2.
26th Feb 2017, 6:27 AM
Deddy Tandean
0
oh sorry, forgot wrote var
26th Feb 2017, 6:29 AM
フェリー
フェリー - avatar
0
and the meaning 10 are?
26th Feb 2017, 6:30 AM
フェリー
フェリー - avatar
0
ok. i got it. thanks very a lot
26th Feb 2017, 6:35 AM
フェリー
フェリー - avatar
0
ok. im sorry, ill remember
26th Feb 2017, 11:07 AM
フェリー
フェリー - avatar