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.
  • (A) test(text)
  • (B) equals(pattern)
  • (C) test(pattern)
  • (D) text==pattern
πŸ’¬ Discuss
βœ… Correct Answer: (D) text==pattern

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
306
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Akshay Kulkarni
Publisher
πŸ“ˆ
98%
Success Rate