Example Enter a list of names with first name first, a space, and then a last name. This version of the program also includes code to capitalize the first letters of names.
Code "use strict"; String.prototype.properCaseName = function () { /^([^ ,])([^ ,]*,? ?)([^ ,])([^ ,]*)$/.exec(this.toString()); return RegExp.$1.toUpperCase() + RegExp.$2 + RegExp.$3.toUpperCase() + RegExp.$4; }; function swapNames(f) { let names = document.getElementById("names").value; let array = names.split(/\s*\n\s*/); for (var i=0; i