write a statement that creates a regexp object that remembers the title and first name, but does not remember the last name. using the regexp object's exec() method, assign the result variable with the remembered title and first name of the string username.

Respuesta :

The statement that creates a regexp object will be:

Code for Dr. Greg House

var userName = "Dr. Greg House"; // Code will also be tested with "Mr. Howard Wolowitz"

//use exec() method

var result = /[A-Za-z.]+\s([A-Za-z]+)\s([A-Za-z]+)/i.exec(userName)

console.log(result[1] + " " + result[2]);

How to illustrate the program?

The program is illustrated based on the information given. In this case the statement that creates a regexp object that remembers the title and first name, but does not remember the last name.

Code for Mr. Howard Wolowitz

var userName = "Mr. Howard Wolowitz"; // Code will also be tested with "Mr. Howard Wolowitz"

//use exec() method

var result = /[A-Za-z.]+\s([A-Za-z]+)\s([A-Za-z]+)/i.exec(userName)

console.log(result[1] + " " + result[2]);

Learn more about programs on:

https://brainly.com/question/26642771

#SPJ1