JavaScript | Regular Expressions JSON | Question 3

Last Updated :
Discuss
Comments

What will the following code output?

JavaScript
const regex = /\d+/g;
console.log("abc123xyz456".match(regex));


["123", "456"]

[123, 456]

["abc", "xyz"]

Error

Share your thoughts in the comments