Javascript function won't print

Javascript function won't print

I'm new to JavaScript and I'm doing a project for class. Haven't had any issues so far until this problem, where nothing prints when I enter the inputs. There are no changes at all when I enter the problems. This problem is just supposed to create a random number and see if the user guesses it correctly.

I'm new to JavaScript and I'm doing a project for class. Haven't had any issues so far until this problem, where nothing prints when I enter the inputs. There are no changes at all when I enter the problems. This problem is just supposed to create a random number and see if the user guesses it correctly.

<script>
function playGame() {
    var answer;
    var x = Math.floor((Math.random() * 100) + 1);
    var name = document.getElementById('name').value;
    var guess = document.getElementById('guess').value;
    if (x > guess) {
    var answer = "Guess is too low!");
    }
    else if (x < guess) {
    var answer = "Guess is too high!");
    }
    else if (x == guess) {
    var answer = "You guessed correctly!");
    }
    document.getElementById('final').innerHTML = "Answer: " + answer;
</script>

<h2>Random Number Game by </h2> <p>Enter Name: <input id="name" type="text"> </p> <p>Enter Guess: <input id="guess" type="number" min="1" max="100" onchange="playGame()"></p> <h2 id="final"></h2>


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Render HTML with Vanilla JavaScript and lit-html

Sometimes you need to render HTML elements on a web page. And like Goldilocks' search for "just right", you have to try a few techniques before you find the right one. Using a framework may be too hard. Using pure HTML and the DOM API may be too soft. What you need is something in the middle that is just right. Is lit-html "just right"? Let's find out.

How to Retrieve full Profile of LinkedIn User using Javascript

I am trying to retrieve the full profile (especially job history and educational qualifications) of a linkedin user via the Javascript (Fetch LinkedIn Data Using JavaScript)

How to Create an Animated Navbar with Html, CSS and JavaScript

In this Html, CSS and JavaScript tutorial you will build an animated navbar with Html, CSS and JavaScript. Have you every wanted to create an awesome animated navbar with JavaScript? We will be looking at making a navbar with Html and CSS and then using the intersection observer in JavaScript to help us create this effect.