frontend/js/randomquote.js
2023-09-14 21:50:19 -04:00

8 lines
341 B
JavaScript

$.getJSON("/quotes.json", function(data){
let index = data[Math.floor(Math.random() * data.length)];
if(index.includes("OGNUM1") && index.includes("SQRTNUM1")) {
let ognum = Math.floor(Math.random() * 3000);
index = "the square root of " + ognum + " is " + Math.sqrt(ognum)
}
$("p#randomquote").text(index)
})