25th Feb 2021, 12:37 AM
Boyan Ivanov
Boyan Ivanov - avatar
9 Réponses
+ 3
function go() { const bill = document.getElementById("bill").value const people = document.getElementById("people").value alert (bill / people) }
25th Feb 2021, 12:41 AM
visph
visph - avatar
+ 3
TheCoder semi-colons are optionnal in js... even if I don't like that and personnally I put semi-colon at end of all my statements ;) here I have just provided the minimal modification to OP code...
25th Feb 2021, 2:11 AM
visph
visph - avatar
+ 1
since mathematical operation do not involved addition, there's nothing wrong to let implicit casting works ;P
25th Feb 2021, 2:24 AM
visph
visph - avatar
+ 1
Okay myself, time to improve our JS! We have to learn A LOT more lol
25th Feb 2021, 2:25 AM
TheCoder
0
bop cho exactly, do what visph said but add semicolons (;) at the end of line 2 - 4! :)
25th Feb 2021, 2:09 AM
TheCoder
0
visph understood, awesome code! But once I didn't use semicolons then after a lot of lines without semicolons it said too many errors scanned 😅
25th Feb 2021, 2:13 AM
TheCoder
0
that's not the lacks of semi-colons fault, but the code length and/or number of error already encountered wich could produce this behavior... ;)
25th Feb 2021, 2:16 AM
visph
visph - avatar
0
Okay, thanks for the information! Wait wait wait... both of us forgot parseInt()! Change the value to an integer then it should work :) Edit: I ran the code without parseInt and it worked... BUT HOW? 🤯🤯🤯
25th Feb 2021, 2:18 AM
TheCoder