+ 2
How can we do easier way in this letter by letter string, to make the first letter capital,
function witParameter(x){ for(var i =0; i<x.length ; i++){ var x = x.charAt(0).toUpperCase()+x.toLowerCase().slice(1) console.log(x[i]) } } witParameter("strings")
5 Antworten
+ 3
Thank you, that's pretty good!
+ 2
Like this?
function witParameter(x){
console.log(x[0].toUpperCase());
for(var i=1; i<x.length ; i++) {
console.log(x[i].toLowerCase());
}
}
+ 1
Some alternatives solutions
https://code.sololearn.com/W2BA3f74yoIv/#js
+ 1
ODLNT. seems little bit advanced,
But took it as coming necessities.