I'm writing code that asks a user to input a number in a window prompt. When the prompt goes away, I want there to be a statement saying "Choose a number between 1 and n" with n being replaced by whatever number they input. Is that something I can do on the HTML side or is it done through JavaScript? I'm very new to this stuff. I've been searching this site all day and trying to figure this out from other posts but I haven't had any luck. Appreciate the help.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<title>Higher Lower</title>
</head>
<body>
<div class="container">
<h1>Higher - Lower</h1>
<p>Guess a number between 1 and n.</p>
let valid_input = false;
let num_range, input;
let number_guesses = [];
// validating that max input is positive
while(!valid_input) {
input = window.prompt("Enter a positive, max value:");
num_range = Number(input);
if(num_range != NaN && num_range > 0) {
valid_input = true;
}
}
document.getElementById('button').addEventListener('choice', do_guess)
Give some id to <p> tag
for suppose - <p id="range">Guess a number between 1 and n.</p>
and add **document.getElementById("range").innerHTML = "Guess a number between 1 and " + input;** right next to **input = window.prompt("Enter a positive, max value:");**