MCQs > IT & Programming > Node.js > Consider two files: first.js and second.js in a Node.js project. Content of the first.js file is given as: module.exports = function() { console.log('function in file first'); Which of the following lines of code should be written in the second.js file in order to import the function given in the first.js file to the second.js file?

Node.js MCQs

Consider two files: first.js and second.js in a Node.js project. Content of the first.js file is given as:

module.exports = function() {

console.log("function in file first");

Which of the following lines of code should be written in the second.js file in order to import the function given in the first.js file to the second.js file?

Answer

Correct Answer:

var x = require('./first');

x();  


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Node.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Node.js MCQ Questions

search

Node.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it