NodeJS beginner solved the problem about exposing attributes in the activity of learning commonjs course. Thank you.

I am a self-taught NodeJs beginner. When I learned the knowledge points of the commonjs section, I did the exercises myself. According to the tutorial video, I first created a tools.js file and exposed the attributes in it. The code is as follows:

 var funs={
    add:function(x,y){
        console.log(x+y);
    },

    say:function () {
        console.log("this is function"s say");
    }

}
module.exports=funs;
 var tools=require("F:\\NodeJs\\nodejs4\\test\\tools.js");

console.log(tools.funs.add(30,2));
console.log(tools.funs.say());

this is correct,
var tools=require ("F:\ NodeJs exercise project\ nodejs exercise 4\ test\ tools.js"); This statement, you can get the tools object by writing this, but the video tutorial teaches var tools=require ("tools") so that you can get the tools object. As long as I write this, I can"t find the tools module, which means I didn"t get the tools object successfully. So, it doesn"t matter if I expose the funs method in tools.js. Anyway, I have to write the complete path to get the tools object, and, Even if the path is written correctly and can be run, there is still something wrong with what console.log prints out.
32
undefined
this is function"s say
undefined
this is what I printed out. I don"t know where the two undefined came from.

that"s what I"m going to ask. One is the question of whether the full path must be written after exposure, and the other is the question of printing out the results. Ask the boss for help, thank you!

Feb.27,2021

1. The relative path . / tools
2. undefined comes from console.log (tools.funs.add (30)); 2)); , where tools.funs.add (30 code 2) returns the result undefined

).
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e948a7-472bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e948a7-472bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?