I made a completely wrong answer here because I didn't know that
var a = /abc/g;
is equivalent to
var a = new RegExp(/abc/g);
I was informed of this in the comments, and I've realized that I'm wrong. I was thinking I should delete my answer, but I hesitated. I thought of it as how Stack Overflow recommends you don't delete a question that has an answer, even if it was a bad question in the first place. Should I not delete my answer because someone might learn from it, or am I overthinking it and should delete?