Javascript .search() issue Uncaught SyntaxError: Invalid regular expression: /*/: Nothing to repeat

Viewed 10146

Can anyone explain this bug for me , what we have here is :

if(statements[bracket].firsthalf.search(math_operators[j])!=-1)

where statements[bracket].firsthalf = "2*a" , math_operators[j]="*" , the console shows the following error:

Uncaught SyntaxError: Invalid regular expression: /*/: Nothing to repeat

any idea why would it show such error ?

enter image description here

2 Answers
Related