Please select one of the following:


The contents of the body in the HTML file:

<script src="script.js"></script>

<p><strong>Please select one of the following:</strong></p>
<button onclick="getName()" style="padding:15px">Name</button>&nbsp;&nbsp;
<button onclick="age()" style="padding:15px">Age</button>&nbsp;&nbsp;
<button onclick="roll()" style="padding:15px">Roll a Die</button>

<div id="output"></div>

The contents of the Javascript file:

function output(stringToOutput) {
  document.getElementById("output").innerHTML = stringToOutput;

function roll() {
  output(Math.floor(Math.random() * 6));

function getName() {
  let input = prompt("What is your name?");
  if (input !== null && input.trim().length > 0)
    output(`Nice to meet you, ${input}`);
    output(`You don't want to tell me your name?`);

function age() {
  let input = Number(prompt("How old are you?"));
  if (input !== null && !isNaN(input) && input > 0)
    output(`You are ${input} year(s) old already?`);
    output(`Don't be ashamed of your age, tell me!`);