str.slice capitalize name javascript code example
Example 1: how to capitalize a letter based on an index in javascript
function capitalize(s,arr){
s = s.split("");
for(var i = 0; i < arr.length; i++){
if (s[arr[i]] == null) { continue }
s[arr[i]]=s[arr[i]].toUpperCase();
}
s = s.join('');
return s;
};
Example 2: capitalize first letter in array of strings javascript
for(var i = 1 ; i < newArr.length ; i++){
newArr[i].charAt(0).toUpperCase();