Multiple comparisons in an if statement using the logical OR operator

前端 未结 5 1880
长发绾君心
长发绾君心 2020-12-11 10:33

I want to do he following, but it does not work:

if(pathname == \'/ik/services/\' || \'/ik/recruitment/\'){
   //run function
}

It is compl

5条回答
  •  星月不相逢
    2020-12-11 11:03

    try doing

        if(pathname == '/ik/services/' || pathname == '/ik/recruitment/'){
          //run function
        }
    

提交回复
热议问题