JSFiddle - React, Tailwind, and code Playground

JavaScript

function num() {
    var x, y;
    while (!(!isNaN(parseFloat(x)) && isFinite(x))) {
        x = prompt('Please enter your first number.');
    }
    while (!(!isNaN(parseFloat(y)) && isFinite(y))) {
        y = prompt('Please enter your second number.');
    }
    x = +x;
	y = +y;
    if (x > y) {
        console.log(x + " is greater than " + y);
    } else if (y > x) {
        console.log(y + " is greater than " + x);
    } else {
        console.log("the two numbers are equal");
    }
 }
 
 num();