I'm getting on the const
train and want to start avoiding let
at all costs.
The problem I'm seeing is the below case - how would I use const
in a situation with more than 2 forks in a logic tree?
What's the equivalent pattern with const?
function getResult(input) {
let result;
switch (input): {
case (1): { result=x;}
case (2): { result=y;}
case (3): { result=x;}
...etc
}
/*
...additional conditionals and functions depending on the outcomes
of switch statement
*/
}
thanks,
See Question&Answers more detail:os