A

Admin • 828.03K Points
Coach

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 pattern matches with the string “text”, the statement is

  • (A) text==pattern
  • (B) text.equals(pattern)
  • (C) text.test(pattern)
  • (D) pattern.test(text)
  • Correct Answer - Option(D)
  • Views: 10
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin
The given pattern is applied on the text given in the parenthesis.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.