Nested switch statement in javascript

前端 未结 4 1160
礼貌的吻别
礼貌的吻别 2021-02-05 05:34

Is it possible to use nested switch statement in javascript.

My code is some what look like

switch(id1)
{
case 1:
     switch(id2){
     ca         


        
4条回答
  •  无人及你
    2021-02-05 06:04

    Basically, it's possible but I think it depends on the complexity of the nesting if it's recommended to use nested switch statement or to use functions with the nested switch statement as Ómar Óskarsson has suggested.

提交回复
热议问题