+ 1
I want to make a program that it takes a name then it writes the first word of the name as a upperCase() with js
how can I write that?
4 Answers
+ 1
Perhaps you mean convert first letter instead of first word.
var name = prompt("Enter your full name", "iran sina");
var words = name.split("");
words[0] = words[0].toUpperCase();
name = words.join('')
alert("Your name is " + name);
https://code.sololearn.com/WltG3DHjEcy4/?ref=app
+ 2
var name = prompt("Enter your full name", "iran sina");
var words = name.split(" ");
words[0] = words[0].toUpperCase();
name = words.join(' ')
alert("Your name is " + name);
https://code.sololearn.com/Wfk6lZY1MUHp/?ref=app
+ 1
I taged
0
Oh thanks Icould to make this program before but my wrong thins was this that I used for and I didn't use of split("");
thank you so much:)