+ 2
JavaScript question ????
var a = "4"; var b = parseInt(a,10); var c = "8"; var d = parseInt(c,10); var e = document.write(b+d); I understande 4 + 8 = 12 but what happened with the 10 number ?
2 Respostas
+ 2
The second argument from the parseInt function, known as radix, tells to which numeral system the string should be converted to. in this case 10 would be the decimal system, so just a normal number. but if the string was for example "04" it would return 4 as well.
+ 1
the 10 is the numerical base(radix)! in this case, is decimal cause it's 10.