The join() method joins all elements of an array into a string.
var name = 'shane osbourne'; var upper = name.split(' ') // [shane, osbourne] .map(x => x.charAt(0).toUpperCase() + x.slice(1)) // [Shane, Osbourne] .join(' '); console.log(upper);