What will be the output of the following JavaScript code? [code] System.out.println(Pattern.matches("[adf]+", "a")); [/code]

What will be the output of the following JavaScript code?
Code:
   System.out.println(Pattern.matches("[adf]+", "a"));
A. true
B. false
C. undefined
D. 0
 
Answer: a
Explanation: “+” sign in regex checks for more than one time occurrence of a particular character. It returns true if a character from the set is present more than once.
 

Tìm kiếm

Back
Top