0

Javascript Control Exericse

Can anyone tell me what's wrong with my code? It actually split out the appropriate result when running the code, however, it produce the prompt twice. And the code doesn't satisfy the requirements" Finish the challenge by typing a number that is greater than 100 and less than 2000 into the prompt." Thanks! Exercise: Prompt the user for a number that is greater than 100 but less than 2000 and store this as a variable named user. Write an if statement that checks to see if user is greater than 100 and less than 2000. If it is then it should assign message1 to a variable named result. If it is not then it should assign message2 instead. My Code: var person = prompt("Enter a number greater than 100 and less than 2000"); var user=parseInt(person); var message1 = 'You are amazingly correct!'; var message2 = 'Awww, it looks like that number is not correct. Try again!'; if (user > 100 && user< 2000){ result =[message1]; } else { result =[message2]; }

5th Sep 2018, 7:11 PM
Dee
2 odpowiedzi
+ 2
You can see the code here. Hope it helps you. https://code.sololearn.com/WerbW0GiR6v2/?ref=app
5th Sep 2018, 8:23 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Thanks so much. I am a bit confused, my code runs in the link provided but it doesn't run in my assignment which still return the same error message. Any advice will help. Thanks!
14th Sep 2018, 7:14 PM
Dee