如何将子函数调用为主函数

时间:2019-01-28 04:40:13

标签: javascript google-apps-script

应用脚本

function Docs() {

  this.getActions = function(p) {

  console.log("get action calling")

  }

我需要在文档功能中调用getActions函数

1 个答案:

答案 0 :(得分:-1)

function Docs() {

  this.getActions = function(p) {
    Logger.log("get action calling")
  }

  this.callActions = function () {
    this.getActions();    
  }
}

function test() {
  var docs;
  docs = new Docs();

  docs.getActions();
  docs.callActions();
}