【发布时间】:2018-06-18 11:17:45
【问题描述】:
我正在 MVC 中使用 Javascript 创建一个 Web 应用程序,其中我有一个如下所示的函数
function test() {
//this function won't do anything but create a new function inside.
function executeLot(lot1, lot2) {
//normal function execution;
}
}
现在我想调用函数executeLot(1,2)
但我无法调用它,因为它位于test()
如何从测试函数外部调用 executeLot。
【问题讨论】:
-
您可以通过这种方式轻松实现。
function test() { //this function won't do anything but create a new function inside. executeLot(lot1, lot2); } function executeLot(lot1, lot2) { //normal function execution; } -
多解释!你是不是只像简单的方法一样使用这个功能?
标签: javascript function