I tried to tweak the steps a bit to enhance my learning but why my output is NaN :(

function monitorCount(rows, columns) {
return rows * columns;
}
monitorCount(5,4);
function costOfMonitors() {
return monitorCount() * 200;
};

const totalCost = costOfMonitors();

console.log(totalCost);

Your call for monitorCount() inside of the costOfMonitors() function requires arguments, but has none! Therefore you’re getting NaN returned from monitorCount(), and hence from costOfMonitors().

1 Like

Thanks, i guess i’m wrong with assuming that if i put the line
monitorCount(5,4); it will be saved as the value for monitorCount

You cannot save a value to a function, it can only perform the actions that are contained within the function definition. What you could do is save the function call to a variable, i.e.

function monitorCount(rows, columns) {
   return rows * columns
}

const numberOfMonitors = monitorCount(5,4)

function costOfMonitors() {
   return numberOfMonitors * 200
}

const totalCost = costOfMonitors()

console.log(totalCost)
# Logs the result "4000" to the console

This would be an acceptable way to do it. But if a function definition requires arguments,in this case rows and columns, then every time you call that function you need to provide these arguments. The only way to store a specific function call is to save it to a variable, like above.

1 Like

Thanks, i clearly got it now :smile: