+ 1

Does anyone know what is wrong with this code?

I can't seem to figure out what is wrong with this code. I do have a theory that it is because the range of numbers you can enter is not specified, and numbers to infinity is too much for the console to process, but I'm not sure that's it, and I'm also not sure how to specify the range of numbers. Any help would be much appreciated. Thank you. https://code.sololearn.com/W89e1yJkjzmi/?ref=app

30th Dec 2017, 12:48 AM
jacksonofgames 28
jacksonofgames 28 - avatar
2 Answers
+ 5
Hi, you have written functions, but you haven't called them. A function will only be invoked once called. Add the following at the top of your code and the closing } at the very end and it works fine :) window.onload = function(){ // this tells the code to run as part of loading the window life(); // this calls your life function. Edit: Joker must have been responding the same time as me :) I hadn't picked up on the single =, I've done that many times as well :)
30th Dec 2017, 12:58 AM
Duncan
Duncan - avatar
+ 3
your else if statement checks box = 2017 change that to box == 2017 = is an assign .. == is a check at the end you have life; change it to life()
30th Dec 2017, 12:53 AM
LordHill
LordHill - avatar