What does this expression return?
new RegExp('\d+').test('42')
- false
- true
- null
- SyntaxError
In a string literal
Play Regex ▸
'\d' is just "d", so the regex becomes /d+/; write '\\d+' instead.