To Upper Case in 30 Seconds— JavaScript

What do we need to do?

function toUpperCaseFunc(str){}
const arrayOfWords = str.split(" ")
for( let i = 0; i < arrayOfWords.length; i++){
let array = arrayOfWords[i]
word.push(array.charAt(0).toUpperCase() + array[i].slice(1))
}
let word = [];
for( let i = 0; i < arrayOfWords.length; i++){
let array = arrayOfWords[i]
word.push(array.charAt(0).toUpperCase() + array[i].slice(1))
}
function(str){
let arrayOfWords = str.split(" ")
let word = [];
for( let i = 0; i < arrayOfWords.length; i++){
let array = arrayOfWords[i]
word.push(array.charAt(0).toUpperCase() + array[i].slice(1))
}
return word.join(" ")
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store