Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a module called myFirst: a . Inside the myFirst module, log a simple text that says My first module on the console. b
Create a module called "myFirst":
a Inside the "myFirst" module, log a simple text that says My first module" on
the console.
b Run the module and see the output of the code you just wrote in this module
c Write a function called "myMultiplier" inside of your "myFirst" module. This
function takes a single number as a parameter and returns a value that is times
the parameter
d Execute the function inside the module. Pass the number to the function
e Save the returned value in a variable and log the variable on the console. Now, run
your module on the terminal to see the printed output
f Export your "myMultiplier" function so that other modules can use it
Create another module called "mySecond":
a Add another function in this module with the same name as above myMultiplier
This function takes a number as a parameter and returns the value that is times
the parameter
b Execute the function inside the module. Pass the number to the function
c Save the returned value in a variable and log the variable on the console. Now, run
your module on the terminal to see the printed output
d Export your "myMultiplier" function so that other modules can use it
Create another module called "myCollector":
a Import both functions from "myFirst" and "mySecond" modules inside of your
"myCollector" module
b Pass the value to both functions that are imported from "myFirst" and
"mySecond" modules
c Run the "myCollector" module on your terminal to display the outputs on your
console
While you are in your "myCollector" module:
a Write a script inside of your "myCollector" module that passes the number to
your "myMultiplier" function that you imported from "myFirst" module and
writes the returned value on a file called "results.txt The result you write on the
file should read like this: "The value of when passed through the myMultiplier
function is
Hint: You will need to find the core Node module that will allow you to
create the resultstxt file and write the result on this file
b Write another script inside of your "myCollector" module that passes the number
to your "myMultiplier" function that you imported from "mySecond" module
and writes the returning value on the same file, the "results.txt on a new line. The
result you write on the file should read like this:
"The value of when passed through the myMultiplier function is
Note: Make sure not to replaceremove what you wrote on your
"results.txt file previously.
Note: Also, make sure to add the new result on a new line, right below the
result written previously.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started