javascripthtmlcssmathjs

How to use mathjs in a normal JS file?


I am trying to use the node package mathjs in a calculator app I am creating. The problem is, I am not running it with node, it is a website I am creating. How can I use mathjs features in my JavaScript on my website?


Solution

  • You could download the library and just include it in your head section as a script tag.

    <head>
       <script type="text/javascript" src="..path to downloaded file" />
    </head>
    

    Or you can avoid downloading it and simply do:

    <head>
       <script type="text/javascript" src="https://cdnjs.com/libraries/mathjs" />
    </head>