0

Can anyone explain this ?!

What is the output of this code? var a="4"; var b=parseInt(a,10); var c="8"; var d= parselnt(c, 10); var e = document.write(b + d); how come the result is 12??????

26th Apr 2017, 9:15 PM
Ionut Marian
Ionut Marian - avatar
1 Réponse
+ 14
4+8 =12 the parseInt() function is converting its first parameter to int. The second parameter (10) is the base. It means it is converted to decimal.
26th Apr 2017, 9:23 PM
Ulisses Cruz
Ulisses Cruz - avatar