JSFiddle - React, Tailwind, and code Playground
by brunolm
JavaScript
function mmlfunc(name, evalcallback, mmlparts)
{
this.name = name;
this.evalcallback = evalcallback;
this.mmlparts = mmlparts;
}
mmlfunc.prototype.evalFunc = function()
{
return this.evalcallback(this.args);
};
mmlfunc.prototype.getMML = function()
{
var mml = this.mmlparts[0];
return mml;
}
function mmlnum()
{
mmlfunc.call(this,
"Value",
function() { return this.val; },
[ '<mn>', '</mn>' ]);
}
mmlnum.prototype = mmlfunc.prototype;
mmlnum.getMML = function()
{
return this.mmlparts[0] + this.val + this.mmlparts[1];
}
var n1 = new mmlnum(),
n2 = new mmlnum(),
n3 = new mmlnum(),
n4 = new mmlnum();
n1.val = 6;
n2.val = 7;
n3.val = 8;
n4.val = 9;