Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
 
PREVIOUS NEXT
Tagged: #camel #case #javascript
ADD COMMENT
Topic
Name
2+5 =