Learn Node.js (Activity 4)

Here is a link to the exercise I’m working on: https://www.codecademy.com/content-items/7e182ef11df387e8b51708a52df36515/exercises/process

I just don’t understand what it is asking me to do.

" We want the program in app.js to store the starting amount of memory used ( heapUsed ), perform an operation, and then compare the final amount of memory used to the original amount. Right now, the initialMemory variable is assigned to null . Change this line, so that initialMemory is instead assigned the value of the heapUsed property on the object returned from invoking the process.memoryUsage() method."

Above are the instructions. Please let me know what I am supposed to do here.

1 Like

Hello, and welcome to the forums!

Step 1 wants you to change this line:

let initialMemory = null;

Instead of setting it to null, it wants you to set it to the value of the heapUsed property from the object returned by process.memoryUsage()

The article above the instructions describes the object that process.memoryUsage() returns, and also gives a specific example of how to get the heapUsed property:


So instead of setting initialMemory to null, set it to process.memoryUsage().heapUsed