Following are 2 functions to get the options in the dropdown. I want to make it to one function rather than 2 different function. There are few options different based on fromtype/totype. But most like case A, I, W etc are common for both the functions. How to make…
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
You could do something like this for your first function, then just combine your options for the second function into the map/set, assuming those options aren't available as from options:
P.S. I hate switch statements, IMO this is a much easier to read solution if you understand Maps/Sets ;) It's also half the amount of code (less if you combine the options from the second function into it).
Thanks Derek :) I will test it out and let you know how it goes.
Sure thing! My original idea was actually to just take any of your strings (assuming it's not an option that returns C or the large array from the default of E) and remove any index after 0 and return that inside an array, as something like W, W1 and W2 all map to the same value, but I don't know what the rest of your data looks like in order to do this.
P.S. Sorry you got downvoted on SO, people on there are so dumb :(