adplus-dvertising
frame-decoration

Question

Consider the following statements:

var text = "testing: 1, 2, 3"; // Sample text
var pattern = /d+/g // Matches all instances of one or more digits

In order to check if the pattern matches with the string "text", the statement is

a.

text==pattern

b.

text.equals(pattern)

c.

text.test(pattern)

d.

pattern.test(text)

Answer: (d).pattern.test(text)

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Consider the following statements: var text = "testing: 1, 2, 3"; // Sample text var pattern = /d+/g // Matches all instances of one or more digits In order to check if the...

Similar Questions

Discover Related MCQs

Q. The JavaScript's syntax calling ( or executing ) a function or method is called

Q. What kind of an expression is "new Point(2,3)"?

Q. Which of the operator is used to test if a particular property exists or not?

Q. Among the following, which one is a ternary operator?

Q. "An expression that can legally appear on the left side of an assignment expression." is a well known explanation for variables, properties of objects, and elements of arrays. They are called

Q. JavaScript is a _______________ language

Q. A statement block is a

Q. When an empty statement is encountered, a JavaScript interpreter

Q. The "var" and "function" are

Q. Consider the following statement:

switch(expression)
{
statements
}

In the above switch syntax, the expression is compared with the case labels using which of the following operator(s) ?

Q. Consider the following statement:

var count = 0;
while (count < 10)
{
console.log(count);
count++;
}

In the above code snippet, what happens?

Q. The enumeration order becomes implementation dependent and non-interoperable if :

Q. What are the three important manipulations done in a for loop on a loop variable?

Q. Consider the following code snippet
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
Will the above code snippet work? If not, what will be the error?

Q. One of the special feature of an interpreter in reference with the for loop is that

Q. What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?

Q. What will be the step of the interpreter in a jump statement when an exception is thrown?

Q. Consider the following code snippet

function f(o)
{
if (o === undefined) debugger;
}

What could be the task of the statement debugger?

Q. Among the keywords below, which one is not a statement?

Q. The unordered collection of properties, each of which has a name and a value is called