javascript 包括 math.js
javascript including math.js
我正在尝试调用 Math.matrix() 函数,我很确定我没有将文件正确导入到我的 javascript 代码中。我已经通读了 Whosebug 问题 "how to include and use math.js":根据该建议,我有以下内容:
<HTML >
<!DOCTYPE html>
<head>
<script src=https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.1.1/math.js>
</script>
<script type="text/javascript" >
function rotate_clockwise(){
/* code skipped */
matrix = Math.matrix(matrix, rotationmatrix);
}
</script>
</head>
<body>
</body>
</HTML>
我从中获取的 cdns 参考 link
但是在 运行 上,当通过滑块调用 rotate_clockwise
时,chrome 68 调试器状态为 Uncaught type error : Math.matrix is not a function
,因此我相信我没有正确包含此文件。
我的基本假设是,在一组脚本标签中包含一个文件一次,足以让任何 javascript 函数使用这个库,它位于另一组脚本标签中。
非常感谢您提供的任何帮助。
我认为你需要 math.matrix(...)
--lower case math
since Math
is a standard JS library。
我正在尝试调用 Math.matrix() 函数,我很确定我没有将文件正确导入到我的 javascript 代码中。我已经通读了 Whosebug 问题 "how to include and use math.js":根据该建议,我有以下内容:
<HTML >
<!DOCTYPE html>
<head>
<script src=https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.1.1/math.js>
</script>
<script type="text/javascript" >
function rotate_clockwise(){
/* code skipped */
matrix = Math.matrix(matrix, rotationmatrix);
}
</script>
</head>
<body>
</body>
</HTML>
我从中获取的 cdns 参考 link
但是在 运行 上,当通过滑块调用 rotate_clockwise
时,chrome 68 调试器状态为 Uncaught type error : Math.matrix is not a function
,因此我相信我没有正确包含此文件。
我的基本假设是,在一组脚本标签中包含一个文件一次,足以让任何 javascript 函数使用这个库,它位于另一组脚本标签中。
非常感谢您提供的任何帮助。
我认为你需要 math.matrix(...)
--lower case math
since Math
is a standard JS library。