In the case of an early return or a guard clause, the return value is not relevant unless hitting the guard is supposed to be an error. In this case, you might throw an error or return something other than just undefined.
Explicitly returning undefined isn’t really useful. An explicit return value should be something other than the default function return value.
If you are not expecting a return value, just return out of the function.
Thank you i thought this would be the case but expected something or other to be slightly inexplicit and obscure , in this case the " guard"
i am not familiar with this concept could you give a brief explanation?
Personally, I think the word “guard” is more explicit about testing for correctness and as such, it should probably throw an error, or return something explicit that informs the caller, and not just return out of the function.