代码示例:(标识:eg_js_es6_arrow)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript 箭头函数</h1>

<p>使用箭头函数,您不必键入 function 关键字、return 关键字和花括号。</p>

<p>IE11 或更早版本不支持箭头功能。</p>

<p id="demo"></p>

<script>
const x = (x, y) => x * y;
document.getElementById("demo").innerHTML = x(5, 5);
</script>

</body>
</html>
运行结果: