I’m examing this code and am trying to figure out why the parameters of monitorCount
need to be reiterated in the costOfMonitors
function? The return of monitorCount
is rows * columns
.
Wouldn’t you then be able to simply make the return of costOfMonitors
:
return monitorCount * 200;
because monitorCount
has already been returned/determined with:
function monitorCount(rows, columns) {
return rows * columns;
Here’s all the code:
function monitorCount(rows, columns) {
return rows * columns;
}
function costOfMonitors(rows, columns)
{
return monitorCount(rows, columns) * 200;
}
const totalCost = costOfMonitors(5, 4);
console.log(totalCost);