I have a string coming in from textarea, how can I change the way a phrase is spelled in the output?
I have this code so far that works well to change each individual word but i need to check for the word before and after:
value = 'This is my text'
value = value.split(' ')
value = value.map(word => {
word === 'This' ?
// Save 'This' and check if the next word is 'is'
// if it's true, replace 'This' and 'is' with 'It's'
: word`}).join(' ')
// Desired output: 'It's my text'