Thank you for stopping by! I am a full-stack developer that combines the power of entrepreneurship and programming to make the lives of programmers easier.
This is a great improvement over the second version.
The only issue I find is that the code for the function is no longer inside the function itself but outside. Maybe this will solve the issues:
lethandlers;function(arg){if(!handlers){handlers[`option1`]=function(){//do a lot of stuff }handlers[`option2`]=function(){//do a lot of stuff }}returnhandlers[arg];}
Functions in functions I would say is smelly code, anyway if there are 5 options each with 7+ LOC then the main function will become too big, that is why I said to make a distinct object/module, with a size of 50+ LOC would probably required its own module. Then the functions being outside is ok, because they are encapsulated by the module.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is a great improvement over the second version.
The only issue I find is that the code for the function is no longer inside the function itself but outside. Maybe this will solve the issues:
Functions in functions I would say is smelly code, anyway if there are 5 options each with 7+ LOC then the main function will become too big, that is why I said to make a distinct object/module, with a size of 50+ LOC would probably required its own module. Then the functions being outside is ok, because they are encapsulated by the module.