Hello (again). This is quickly become my favorite place to be throughout the day.
I was trying to use the Javascript toPrecision() method (https://moodleformulas.org/course/view.php?id=22§ion=27) and I cannot for the life of me get it to work. I even went so far as to copy and past all the exact html and script into a new question and it failed to work when transferred yet it works in the xml file that I downloaded and imported.
I have attached an xml file of my experimenting and I do not see why it will not work.
<p>{a}<br></p>
<p><span id="xr11"></span></p>
<script>
document.getElementById("xr11").innerHTML = f201803241848({
a
}, 1);
function f201803241848(x, s) {
var xr = x.toPrecision(s);
return xr;
}
</script>
{a} is defined as 1.23456789 in the global variables.
Any help on what I am missing and how to make this work would be appreciated.
Thanks