Total cost shows up as $0 in my js restaurant demo. Why?
mhs_mhs123 (4)

Hey everyone, I am a new python and js dev and I'm trying to learn the syntax for both these languages. I'm currently working on a restaurant demo in javascript. Everything works great until the last alert message where it displays the total cost as $0 for the user. Any help would be appreciated. Thanks and have a great day!

You are viewing a single comment. View All
eankeen (695)

@mhs_mhs123 Yeah, but when you change constmeal, it doesn't automatically update totalcost, unfortunately.

So you might have to do something like this

var totalcost = Number((costmeal + costdrink));

near the end of your program, rather than the beginning (because at the beginning costmeal and costdrink are 0) :)