Question: Write a statement that creates a RegExp object that remembers the title and last name, but does not remember the first name. Using the RegExp
Write a statement that creates a RegExp object that remembers the title and last name, but does not remember the first name. Using the RegExp object's exec() method, assign the result variable with the remembered title and last name of the string userName.
const userName = "Dr. Greg House"; // Code will also be tested with "Mr. Howard Wolowitz"
/* Your solution goes here */
console.log(result[1] + " " + result[2]);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
