Page 1 of 1

Problem with the toLowerCase and toUpperCase function

Posted: Sun Oct 23, 2022 3:45 pm
by Monomone
Hey guys I'm trying to make my first webtease but I'm encountering a problem. I have taken the name of the player with a prompt and saved it to a variable called 'name'. I want this to always have a capital first letter and the rest lowercase (because it's a name) and I've tried to do that using an eval with as seen in the picture below. When I tested it by using a say command that said : 'name2'. When I filled in jAmES (not my real name) it returned me exactly what I put in. What am I doing wrong?
Knipsel.PNG
Knipsel.PNG (8.95 KiB) Viewed 1035 times

Re: Problem with the toLowerCase and toUpperCase function

Posted: Sun Oct 23, 2022 3:50 pm
by Monomone
Okay now it just gives me the capital letter J (using James)??????

Re: Problem with the toLowerCase and toUpperCase function

Posted: Sun Oct 23, 2022 4:36 pm
by Monomone
fixed it :)
Ended up using the following script with a prompt saving to 'inputname'
name1 = inputname.toLowerCase();
name = name1.charAt(0).toUpperCase() + name1.slice(1);