I'm trying to work on a project and I only understand bits and pieces of what I need to be doing. Goal: create a web page that prompts the user to enter a number which represents how many temperatures the user intends to enter. Then, the user will enter that amount of temperatures one at a time, and when the amount has been reached, the program display each of the temperatures entered on its own line on the screen, and then show the average of the temperatures that have been collected.
My current problem is that I don't know how to create an array from prompt input. The prompts are the way I would like them to be, but after that I'm lost. I wrote an idea of what I think I'm looking for, but that may not even be the right direction. After I figure the array part out I'll need to figure out how to average the numbers, but that's not my biggest concern. The document.write() at the bottom is the layout for what I would like to ultimately appear on the screen.
var number = parseInt( window.prompt("How many temperatures would you like to average?"));
for (var i = 0; i < number; i++) {
window.prompt("Enter temperature")
}
var temps = new Array(number[i]);
for (var j = 0; j < temps.length; j++); {
document.write(temps[j] + "<br>");
}
document.write("There are" + number + "temperatures to average." + "<br>" + temps[j] + "<br>"
+ "The average of your temperatures is:" + avg);
const temps = []; for (let i = 0; i < number; i++) temps.push(prompt("Enter temperature"))window.prompt()to a varable.number[i]is wrong.numberis not an array, it's the length of the array you want to create.document.write()to display your web page, tell them to join the 21st century.