+ 2
Why reading the innerHTML of the paragraph should not be converted into numeric to be able to divide it?
function fun() { var obj = document.getElementById("text") var n =obj.innerHTML; obj.innerHTML = n/2; } https://code.sololearn.com/Wq0iwqH2wp90/?ref=app
1 Respuesta
+ 3
because the division operator implicitly converts the string to integer. it also works with - and * but not + because that would already mean concatenation of strings
yes that is javascript for you, super lenient high level language. but if u encounter some med level langs like me learning java, i always have syntax errors lol