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

<h1>JavaScript 函数</h1>

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

<script>
var myFunction = function (a, b) {return a * b}
document.getElementById("demo").innerHTML = myFunction(4, 3);
</script>

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