Hello, searching for Regular Expression, I've got a link to MDN: [1]: link , but I looked, looked and did not understand because the example tested twice each variable, and because the last test returned false. The part of the given example, which I need to understand is:
var regex1 = RegExp('foo*');
var regex2 = RegExp('foo*','g');
var str1 = 'table football';
console.log(regex1.test(str1));
// expected output: true
console.log(regex1.test(str1)); // porque testar de novo?
// expected output: true
console.log(regex2.test(str1));
// expected output: true
console.log(regex2.test(str1)); // por que testar de novo e por que retornou false?
// expected output: false