I'm very new to JavaScript, and am trying to use decimal.js, for a project that requires its fractional exponents.
I've been trying every variation that I see in examples, but my variable declarations are failing, causing the script to abort. The result is a blank document.
I've stripped the script down, to include just what I think will be needed for this question.
<HTML>
<HEAD>
<TITLE>My First Script</TITLE>
<script src="http://mikemcl.github.io/decimal.js"></script>
<!--
<script src="https://unpkg.com/mathjs/dist/math.js"></script>
-->
<HR>
<H1>Title</H1>
<HR>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript"> <!--
function myFunction(parm) {
var Decimal = require('decimal.js')
Decimal.set({precision: 200});
var dn = new Decimal(parm)
document.write(dn)
}
myFunction(123.456789)
// --> </SCRIPT>
</BODY>
</HTML>