JSFiddle - React, Tailwind, and code Playground

JavaScript

var name = "AlbERt EINstEiN";

function nameChanger(oldName) {
var finalName = oldName;
// Your code goes here!
finalName = oldName.toLowerCase();

finalName = finalName.replace(finalName.charAt(0), finalName.charAt(0).toUpperCase());

for(i = 0; i < finalName.length; i++) {
    if (finalName.charAt(i) === " ") {
        var startLetter = finalName.slice(i+1, i+2);
        finalName = finalName.slice(0, i+1) + startLetter.toUpperCase() + finalName.slice(i+2);
    }
}

return finalName;
};

// Did your code work? The line below will tell you!
console.log(nameChanger(name));