Answers for "camel case first javascript"

0

camel case first javascript

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)
Posted by: Guest on August-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language