Why isn't the script displaying text?
I'm trying to review and practice conditional statements. I made an if else statement that will Display a string in a paragraph depending on the conditional value of the variable "hungerLevel". I can get it done easily with document.write but I'm aware this command is only for testing purposes and not actual display of text. Why isn't my code working? Id appreciate the help! <p id="text"></p> <!---- Hunger Script ----> <script> var hungerLevel= prompt("How hungry is Natsuki?") if (hungerLevel<10) { document.getElementById('text').innerHTML("Natsuki isnt hungry."); } else { document.getElementById('text).innerHTML ("Natsuki is hungry! Let's get her some treats!"); } </script> </body>