This is a test error log coming from the fact that your function is returning undefined. There is a test trying to access the length property of undefined – your return value – to verify your result.
“Why does my function return undefined?”
Because that’s the default return value of JavaScript functions that aren’t a constructor.
To return a value other than the default, a function must have a return statement that specifies the value to return. A function without a return statement will return a default value. In the case of a constructor called with the new keyword, the default value is the value of its this parameter. For all other functions, the default return value is undefined.