Skip to content

Instantly share code, notes, and snippets.

@ar2zee
Created April 10, 2017 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ar2zee/85767466f9b1bf1f864387757c126bcd to your computer and use it in GitHub Desktop.
Save ar2zee/85767466f9b1bf1f864387757c126bcd to your computer and use it in GitHub Desktop.
easy method with strings
var Genius = 'AlBErt EinsTeIn'
function changingName(oldName){
var FixedName = oldName;
var names = oldName.split(' ');
names[1] = names[1].toUpperCase();
names[0] = names[0].slice(0,1).toUpperCase() + names[0].slice(1).toLowerCase();
FixedName = names.join(' ');
return FixedName;
}
console.log(changingName(Genius));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment