The basic premise is I want to find a character following another and then replace that with its uppercase equivalent. I’m looking for a more elegant solution than indexOf and a for loop. I’ve got this far:
'this-is-my-string'.replace(/\-(\w)/,'$1')
which gives me thisismystring but I want thisIsMyString. Anything I can do to change $1 into its uppercase equivalent?
You can use give replace a function as the second argument and whatever it returns will be used: