嘿,我的javascript文件中有如下三个函数

token.js

const function1 = async (token) => {
  .....
};

const function2 = async(token, permission) => {
    // I want to call function1 here like
    function1(token);
};

module.exports = { function1, function2 }


function2中,我想调用函数,这给我一个错误function1 is not a function

有谁知道如何解决这个问题?

最佳答案

它应该正在工作。检查此:working functions


'use strict';

const function1 = async (token) => {
  console.log(token);
};

const function2 = async(token, permission) => {
    // I want to call function1 here like
    function1(token);
};

function2('apple','ball');

关于javascript - 如何在Node.js中的另一个箭头函数中调用箭头函数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49727451/

10-09 17:54