Adding a new TeX command to MathJax 3

This page shows how to add a new \var TeX command to MathJax 3, which parses its (non-TeX) input and returns TeX code to go be substituted for the macro.

See the code

\( \var{x*x} \)

\( \var[upper]{a*b} \)