JSFiddle - React, Tailwind, and code Playground
HTML
<input id="global" type="number" min="1" value="6">
JavaScript
let global = 6;
window.onload = function(){
document.getElementById("global").onchange = function(){
global = this.value;
testing(7);
}
}
function testing(param){
mod(param, global);
}
function mod(a, b){
let result = ((a%b)+b)%b;
console.log("mod of ", a, " and ", b, " is:", result);
return result;
}