JavaScript 中的 eval() 函数
htmljavascriptprogramming scripts更新于 2024/10/17 14:04:17
eval() 函数接受一个包含 JavaScript 代码的字符串值。此函数执行给定的代码并返回代码的结果。
语法
其语法如下
eval(32*45);
示例
<html>
<head>
<title>JavaScript 示例</title>
</head>
<body>
<script type="text/javascript">
document.write(eval(32*45));
document.write("<br>");
document.write(eval(new String("Hello welcome to Tutorialspoint")));
</script>
</body>
</html>
输出
1440 Hello welcome to Tutorialspoint
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

