Purpose of JSLint “disallow insecure in regex” option

后端 未结 2 917
别那么骄傲
别那么骄傲 2020-12-15 15:44

I have a line of code that gets the following error when run through JSLint:

Lint at line 604 character 48: Insecure \'^\'.
numExp = parseInt(val[1].replace(         


        
2条回答
  •  佛祖请我去吃肉
    2020-12-15 16:22

    All it's trying to tell you is that it's generally better to specify what can be entered instead of what can't.

    In this case, your regex is actually stripping out bad characters, so it's safe to ignore the warning.

提交回复
热议问题