Please help me find my mistake, in that I having problems with step 4.
Step 1: Imagine if we needed to order monitors for everyone in an office and this office is conveniently arranged in a grid shape. We could use a function to help us calculate the number of monitors needed!
Declare a function
monitorCount() that has two parameters. The first parameter is
rows and the second parameter is
Step 2: Let’s compute the number of monitors by multiplying
columns and then returning the value.
In the function body of the function you just wrote, use the
return keyword to return
rows * columns .
Step 3: Now that the function is defined, we can compute the number of monitors needed. Let’s say that the office has 5 rows and 4 columns.
Declare a variable named
numOfMonitors using the
const keyword and assign
numOfMonitors the value of invoking
monitorCount() with the arguments
Step 4: To check that the function worked properly, log
numOfMonitors to the console.
Here’s my Code!
const numOfMonitors = monitorCount(5,4);
return rows * columns;