a = /\d+/.exec;
a("hello,123")
I getting the following error:
Error: can't convert undefined to object
Why is a returned as undefined?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ain this case is a reference to theRegExp.prototype.execfunction itself, and is not actually bound to any regular expression. Either of these would work:Your
undefinedis coming from an internal reference tothisfrom within theexecfunction.