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]?”, “a”));

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

Answer: a
Explanation: The above code tests for single occurrence of the character in a particular string. The symbol ? is used along with the “[]” for testing single occurrence.

Join The Discussion