JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="exploreFunction()">Explore</button>
<div id="story1"></div>
JavaScript
var current = 0;
var person;
var story = ["-You wake up lying on the ground. You feel a large deposit of energy inside you.", "-You go to the right.", "-The path is blocked.", "-The End"];
function exploreFunction() {
if (current == 0) {
person = prompt("What is your name", "");
}
if (person != null && current < story.length) {
document.getElementById("story1").innerHTML = story[current];
current += 1;
}
}