I have a doubt as to how to pass variables into a function call that is inside an onclick attribute. It's actually a bad practice but I still want to know in case I ever need.
For Example:
let parsed = document.querySelector('input').value.replace('/\^/','**');
function evaluat(expr){
console.log(eval(expr));
}
<input></input>
<p><button onclick="evaluat(parsed)">Compute</button></p>
This code prints undefined for the input 5^2 instead of the expected 25.