Code not running in IE 11, works fine in Chrome

前端 未结 8 1235
春和景丽
春和景丽 2020-12-04 17:16

The following code can be run without a problem in Chrome, but throws the following error in Internet Explorer 11.

Object doesn\'t support property or

8条回答
  •  被撕碎了的回忆
    2020-12-04 17:47

    While the post of Oka is working great, it might be a bit outdated. I figured out that lodash can tackle it with one single function. If you have lodash installed, it might save you a few lines.

    Just try:

    import { startsWith } from lodash;
    

    . . .

        if (startsWith(yourVariable, 'REP')) {
             return yourVariable;        
        return yourVariable;
           }      
         }
    

提交回复
热议问题