<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<!-- IE11 及更早 IE 版本不支持箭头函数。 -->
<body>
<p id="demo"></p>
</body>
<script>
const x = (x, y) => {
// 返回x乘以y的值
return x * y;
};
// 计算x乘以y的值
document.getElementById("demo").innerHTML = x(5, 5);
</script>
</html>
运行结果