Am I missing something with this code?

My code for the third step returns an error even though my code looks exactly like the code in the hint. Could somebody explain to me what I am doing wrong?:

The task says:

  • 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 5 and 4 .*

I translated that into the following code:

function monitorCount(rows, columns) {
return(rows * columns);
}
const numOFMonitors = monitorCount(5, 4);

As I am an absolute beginner, like as not I either made a sloppy mistake or my logic is off.

Thanks in advance for your help

The code looks okay but for two things…

  1. return(rows * cols); => return rows * cols;

Thanks for the correction, @mtf

The variable name was the issue

1 Like