So, I had this code working great. But then I realized my assignment was to create a function (in the <head>) that could be called more than once (in the <body>) and would return different results. So, I added some code and now... Well, here's the code:

PHP Code:
//in the <head>
var name
var capitalLetter
var smallLetters
var correctedName
var firstName
var lastName
    
    
function proper(name) {
            var 
firstLetter name.substring(0,1);
            var 
theRest name.substring(1);
            
capitalLetter firstLetter.toUpperCase();
            
smallLetters theRest.toLowerCase();
            
correctedName = (firstLetter theRest);
            return 
correctedName;
                              }

//in the <body>
var name prompt("Please enter your first name. And feel free to type it all wonky (lots of capital letters).""First Name");
proper(name);
firstName correctedName;
name prompt("Please enter your last name. And feel free to type it all wonky (lots of capital letters).""Last Name");
proper(name);
lastName correctedName;

document.write("<p>Your name is " firstName " " lastName ".</p>"); 
Now it will return the names, but they're still "wonky", as in not corrected to Upper and Lower case letters. If I type "TyLeR DuRdEn" it returns the same. Can someone give me a hand?