我已经尝试过x.add(3,4)和x().add(3,4),但这是行不通的.
请让我知道我要去哪里了.
<html>
<body>
<p>
After a function has been stored in a variable,the variable can be used as a function:
</p>
<p id="demo">
hello
</p>
<script>
var x = function () {
var add = function(a,b) { return a + b };
var mul = function(a,b) { return a * b };
}();
document.getElementById("demo").innerHTML = x.add(3,4);
</script>
</body>
</html>
最佳答案
原文链接:https://www.f2er.com/js/531128.html