Even after years of experience with Javascript there are new surprises around every corner.
const regex = /foo/g;
if (regex.test('foo bar') && regex.test('foo car'))
console.log('🎉');
else
console.log('🙃');
What do think is the result? You find the explanation in the MDN documentation.
Top comments (0)