0
How do i fix my Calculation
9 Respuestas
+ 3
function go() {
const bill = document.getElementById("bill").value
const people = document.getElementById("people").value
alert (bill / people)
}
+ 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...
+ 1
since mathematical operation do not involved addition, there's nothing wrong to let implicit casting works ;P
+ 1
Okay myself, time to improve our JS! We have to learn A LOT more lol
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 😅
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... ;)
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? 🤯🤯🤯