I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
With your current code setup, you would need to write an if/else chain to accommodate all of those names.
I would suggest simplifying your approach.
You basically want to say if the function wasn’t called with any arguments passed in return “Hello Friend!”
If the function was called with an argument that is a string then return Hello, name(name represents the name passed into the function call)
You could try looking into aruguments object
If you don’t want to use the arguments object, then you can use a ternary to basically use the same logic I stated earlier but checking if name is undefined.
There is more than one way to approach this but that would be my approach.