I need some help with writing a loop. I'm still learning javascript and here is what i've done when manually creating the variables. As you can see I am basically creating three variables but because I dont know how to put this in a loop I have to manually declare each variable which is a pain as the input increases. For example this is really 4 items and there calories. If I wanted to do 20 items and there calories it would be a nightmare. what I would like to do is ask a if statement that ask's how many items did i eat today and the loop would then ask for the information below and stop when the if statement was satisfied.
var Food1 = window.prompt("What did you eat today?");
var Cal1 = window.prompt("How many calories was " + Food1);
var num1 = parseInt(Cal1);
var Food2 = window.prompt("What did you eat today?");
var Cal2 = window.prompt("How many calories was" + " " + Food2);
var num2 = parseInt(Cal2);
var Food3 = window.prompt("What did you eat today?");
var Cal3 = window.prompt("How many calories was " + Food3);
var num3 = parseInt(Cal3);
var Food4 = window.prompt("What did you eat today?");
var Cal4 = window.prompt("How many calories was" + " " + Food4);
var num4 = parseInt(Cal4);