--

Yeah Exactly its an multiple if else conditions and not nested if else conditions as you said.

If we have 2 or 3 checks then if else good. and if have less than 5 to 6 checks then the switch case is good but if we have more than 6 checks then your code will be more than at least 6 * 4 = 24 lines. It makes difficult to read.

basically what map does is like checking the key and if exists it will get the value. It will increase the readability as well.

--

--

No responses yet