0 votes
in JavaScript by
Consider the following snippet of JavaScript code:

var text ="testing: 1, 2, 3";// Sample text  

var pattern =/\d+/g// Matches all instances of one or more digits  

Which one of the following statement is most suitable to check if the pattern matches with the sting "text".

a) test(text)

b) equals(pattern)

c) test(pattern)

d) text==pattern

1 Answer

0 votes
by

Answer: D

Reason: The given pattern is applied on the string "text" enclosed in the parenthesis.

Related questions

0 votes
asked Mar 20, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 20, 2021 in JavaScript by sharadyadav1986
...