Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Consider the following JavaScript statement containing regular expressions and check if the pattern matches?
var text = “testing: 1, 2, 3”;
var pattern = /d+/g;

Consider the following JavaScript statement containing regular expressions and check if the pattern matches?
var text = “testing: 1, 2, 3”;
var pattern = /d+/g;
a) text==pattern
b) text.equals(pattern)
c) text.test(pattern)
d) pattern.test(text)

Answer: d
Explanation: The given pattern is applied to the text given in the parenthesis. The test() method tests for a match in a string. This method returns true if it finds a match, otherwise it returns false.

Join The Discussion