Home HTML JavaScript DOM Data Types

HACK COMPLETE

%%js

%%js
let a = parseFloat(prompt("Enter the value for a:"));
let b = parseFloat(prompt("Enter the value for b:"));

if (!isNaN(a) && !isNaN(b)) {
  if (a > b) {
    console.log("a is greater");
  } else if (b > a) {
    console.log("b is greater");
  } else {
    console.log("both are equal");
  }
} else {
  console.log("Please enter valid numeric values for a and b.");
}
<IPython.core.display.Javascript object>