Hello, here is my method I have created for the Lodash Library Project, I am getting an error of invalid count value. I have tried to use the value of the variables in place of the name of the variable and it passes the evenly spaced test but obviously will not pass the odd spaced padding test at the same time which is what I am looking to do but when using the variable name in place of variable value in the repeat method it returns an invalid count value error.
Thank you
pad: function (string, length) {
let startPad = Math.floor((length - string.length) / 2);
let endPad = length - string.length - startPad;
let space = `${' '.repeat(startPad)}${string}${' '.repeat(endPad)}`;
if (string.length < length) {
// return `${startPad}${string}${endPad}`;
return space;
} else if (string.length > length) {
return string;
} else if (string.length === length) {
return string;
}
//return `${startPad}${string}${endPad}`;
return space;
}