Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question relates to Javascript. What is the simplest way to modify the code below so that it keeps asking for the user to enter

This question relates to Javascript.

What is the simplest way to modify the code below so that it keeps asking for the user to enter the correct value if the user enters an incorrect response. At the moment the code willaccept empty that the user enters nothing. Please show me how to fix this. Please keep it simple because I am new to coding.

const VALID_TEAMS = ["Australia","New Zealand","South-Africa","Pakistan","Brazil","West Indies"]; const MIN = 0; const MAX = 30; const TEAM_NUM = 6; var score = 0; var findTeam; var team; var i; document.writeln(""); for(i=0;i<=TEAM_NUM;i++){ team = prompt("enter the team"); findTeam = VALID_TEAMS.indexOf(team); if(findTeam>=0 && findTeam<=5){ document.writeln(""); document.writeln(""); score = prompt("enter the score"); while(isNaN(score) || score<0 || score>30 || score %3 !=0){ score = prompt("enter the score"); } document.writeln(""); } document.writeln(""); } document.writeln("

"+team+" "+score+"

");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions

Question

Have I incorporated my research into my outline effectively?

Answered: 1 week ago