Q. Consider the following snippet of JavaScript code:
Which one of the following statement is most suitable to check if the pattern matches with the sting "text".
Code:
var text ="testing: 1, 2, 3";// Sample text var pattern =/\d+/g// Matches all instances of one or more digits.
β
Correct Answer: (D)
text==pattern