easy method with strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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