const country = 'united kingdom'
const countryArr = country.split(' ')
const newcountry = countryArr
.map((val) => {
const pattern = new RegExp(`^[${val}]`, 'i')
return val.replace(pattern, `${val.charAt(0).toUpperCase()}`)
})
.join(' ')
.trim()
console.log(newcountry)