DEV Community

Cover image for Fun with Javascript!
Klaus Herberth
Klaus Herberth

Posted on

Fun with Javascript!

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('🙃');
Enter fullscreen mode Exit fullscreen mode

What do think is the result? You find the explanation in the MDN documentation.

Top comments (0)