So here is the overall of what I need to do
Start with confirming if the user wants to add a course, if they click ok it gives them a prompt to enter course if they hit cancel it finishes the program.
When the user gives an answer to the course, they then need to give their grade for that specific course.
Once those two questions are done it needs to go back to ask them if they want to add a course again
this is what i have so far
while (true) {
var entering = confirm('Do you want to enter a Course?');
if (entering = true) {
break;
}
}
var codeInput = '';
var gradeInput = '';
while (true) {
codeInput = prompt('Enter Course Code');
if (codeInput.length === 7) {
break;
}
alert('invalid code');
}
gradeInput = prompt('Enter Grade for ' + codeInput + '');
document.writeln('<table border="1">');
document.writeln('<tr>');
document.writeln('<th>Course Code</th>');
document.writeln('<th>Grade</th>');
document.writeln('<tr>');
document.writeln('<th>' +
codeInput +
'</th>');
document.writeln('<th>' +
gradeInput +
'</th>');
document.writeln('</tr>');
So I'm not sure how to loop it back to the start and how to make the program stop when you hit cancel when it asks if you want to add another course. I also do not know how to make it so if the user asks to enter another course/grade how to make them into a separate answer to add below in the table.
I hope this makes sense and if anyone can help would be lovely thank you!
ps. This has to all be done using javascript no HTML.