FrontendInterviews.dev

686. RegExp.test Global lastIndex Wrap

Easy•

Predict the output.

const r = /a/g
console.log(r.test('a'), r.test('a'), r.lastIndex)

What is printed in the console?

Select an option and submit your answer.
Next Problem