Answer the question
In order to leave comments, you need to log in
How to pass a parameter to an exported function?
It is necessary to pass an array to the setValues() function, I write on node.js
The function itself is in the index.js file
module.exports = async function setValues(arr){
//some code
console.log(arr)
}
const exported = require('./index')
async function fun(){
let array = []
array .push(1)
//some code
exported.setValues(array)
}
Answer the question
In order to leave comments, you need to log in
exported is already an import function because in index.js the exported object is the function
https://www.tutorialsteacher.com/nodejs/nodejs-mod...
const exported = require('./index');
async function fun() {
exported([1]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question