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.

What will be the output of the following JavaScript code?
console.log(Pattern.matches(“[amn]”, “abcd”));

What will be the output of the following JavaScript code?
console.log(Pattern.matches(“[amn]”, “abcd”));
a) true
b) false
c) undefined
d) a

Answer: b
Explanation: The pattern.matches method tests whether the regular expression matches the pattern. The above code will result into false as string “abcd” is not among a, m, or n.

Join The Discussion