Javascript Lodash library project issue

Hello, i am currently recreating the Lodash library in this lesson :


I am stuck as i cannot understand why when i test the method in the terminal, i get the response “_.pad was not properly defined”.

Here’s my code:

pad(string, length) {
  if(string.length >= length){
   return string;
const startPaddingLength = Math.floor((length - string.length) / 2); 
const endPaddingLength = length - string.length - startPaddinglength;
const paddedString = ' '.repeat(startPaddingLength) + string + ' '.repeat(endPaddingLength);
return paddedString;

Here’s a screenshot of my screen :

I don’t know where i went wrong, if anyone can help me figure this out i will really appreciate it, thank you.

Be sure to Save before running the test.

I’m getting an error when testing invert

Any help would be very much appreciated!

The code on line 46 is suspect. Should it be object notation? Or subscript key notation?

Object notation, thanks for looking it over.

So the passing code is:

invert(obj) {
let newObj = {};
for (let item in obj){
newObj[obj[item ]] = item;
return newObj;

Still trying to figure out what was wrong with the original code.

I did save the code multiple times and it corresponds with the tutorial video completely. It’s the second time now that ive written the code in hope that i might correct some hidden mistake, but ive hit a wall.

invertedObject = {originalValue : key}

The end result will be only the object created by that line.

Take a look at the post above yours and look for hints to help with your solution.