Lodash project help (code working on VSC but not on the codeacademy page)

Hi everyone.

I’m wondering why would this code work on vsc:

pad(string, length) {

const check = string.length < length ? true : false;

const spaces = length - string.length;



let str = string;



if (check === true && spaces % 2 === 0) {

  const padding = spaces / 2;

  str = str.padEnd(str.length + padding, ' ');

  str = str.padStart(str.length + padding, ' ')

  

} else if (check === true && spaces % 2 === 1) {

  const oddPadding = spaces - 1;

  const oddSpace = oddPadding / 2;

  str = str.padEnd(str.length + (oddSpace + 1), ' ')

  str = str.padStart(str.length + oddSpace, ' ');

  

} else if (check === false) {



  return string;

};

  return str;

},

giving me all green passed tests:

but give me the following error on the codeacademy website:

Any ideas?