如何在普通的 JS 文件中使用 mathjs?
How to use mathjs in a normal JS file?
我正在尝试在我正在创建的计算器应用程序中使用节点包 mathjs。问题是,我不是 运行 它与节点,它是我正在创建的网站。如何在我的网站 JavaScript 中使用 mathjs 功能?
您可以 download the library 并将其作为 script
标签包含在您的 head
部分中。
<head>
<script type="text/javascript" src="..path to downloaded file" />
</head>
或者您可以避免下载它而只需执行以下操作:
<head>
<script type="text/javascript" src="https://cdnjs.com/libraries/mathjs" />
</head>
在他们的网站上,他们通过 https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.5.1/math.min.js
上的 cdn 提供它
您可以在您的页面中添加 link,然后通过 math
变量
可以使用它
console.log(math.add(1, 1));
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.5.1/math.min.js"></script>
How/When/Where你加载它在很大程度上取决于你网站的需要。
我正在尝试在我正在创建的计算器应用程序中使用节点包 mathjs。问题是,我不是 运行 它与节点,它是我正在创建的网站。如何在我的网站 JavaScript 中使用 mathjs 功能?
您可以 download the library 并将其作为 script
标签包含在您的 head
部分中。
<head>
<script type="text/javascript" src="..path to downloaded file" />
</head>
或者您可以避免下载它而只需执行以下操作:
<head>
<script type="text/javascript" src="https://cdnjs.com/libraries/mathjs" />
</head>
在他们的网站上,他们通过 https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.5.1/math.min.js
上的 cdn 提供它您可以在您的页面中添加 link,然后通过 math
变量
console.log(math.add(1, 1));
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.5.1/math.min.js"></script>
How/When/Where你加载它在很大程度上取决于你网站的需要。