描述
有一组字符串和一个正则表达式条件。我只是循环浏览这些行并检查它们RegExp.test():
const regex = new RegExp(`A`, `gmi`);
const examples = [
`A-3-1`,
`A-3-1`,
`A-3-1`,
`A-3-1`,
`A-3-1`,
`A-3-1`,
`A-3-1`,
`A-3-1`,
];
for (let index = 0; index < examples.length; index++) {
const example = examples[index];
console.log(`${example} -> ${regex.test(example)}`);
}
特地取了8条相同的线放在数组里。
问题
如果字符串相同且条件相同,为什么每秒都会返回一次检查。false

