Lower, Upper, Title, Proper - Text Case Formatting


I am trying to get the property address to display as:

2748 Warren Place, Langley, V2Y 1C3

toLowerCase(), toUpperCase() works but I can’t seem to find how to get it the way I want like I have underlined above.

We don’t have to worry about the city or postal code since they are in the case format we want already. We just want to change the first part of the address to title case.

I’ve tried:

toTitleCase()
toProperCase()

Thanks!

try this:

let address = itemData.address.toLowerCase()
.split(’ ‘)
.map((s) => s.charAt(0).toUpperCase() + s.substring(1))
.join(’ ');

At the bottom, use ‘address’ instead of ‘itemData.address.toLowerCase()’

Good luck!