코드 :
function uppercase(str)
{
var array1 = str.split(' ');
var newarray1 = [];
for(var x = 0; x < array1.length; x++){
newarray1.push(array1[x].charAt(0).toUpperCase()+array1[x].slice(1));
}
return newarray1.join(' ');
}
console.log(uppercase("the quick brown fox"));
결과 :
The Quick Brown Fox
등록된 댓글이 없습니다.