+ 2
Wrap your prompt() call in parseInt( ) or parseFloat( ), depending on what type of number you expect. parseInt(): https://www.geeksforgeeks.org/javascript-parseint-with-examples/ parseFloat(): https://www.geeksforgeeks.org/javascript-parsefloat-with-examples/
22nd Nov 2018, 8:26 PM
Shadow
Shadow - avatar
+ 1
You should enclose the term 250 - healthSelect in braces. The reason for this is that you perform string addition - since prompt() takes in a string as its argument - and the '-' operator is not specified for such a task. However, if you wrap the term in braces, it will be considered as integer subtraction, and afterwards the result will be added to the string before it.
22nd Nov 2018, 8:44 PM
Shadow
Shadow - avatar