JSFiddle - React, Tailwind, and code Playground

by akang2

HTML

<input type="button" value="CLICK ME" id="butt">

JavaScript

//Practicing Again starting with asking names and capitalizing first letter

//declaring vars
var name;
var fullName="";
var firstLetter;

//create a var that grabs the ID
var theButt = document.getElementById('butt');

//create the function that does the prompt
/*function askMe(){
   var name = prompt('gimme a name','right here');
};*/

fixName=function(){
//code that capitalizes first letter
firstLetter = name.substring(0,1);
name=firstLetter.toUpperCase()+name.substring(1);
fullName=fullName + " " + name;
};

//attach the function to onclick event
name = prompt('gimme a name','right here');    
fixName();

name = prompt('gimme a name','right here');
fixName();

document.write("you're" + fullName);
    
//function that fixes the name