I have a variable that can store compound words, as in the example below. I would like help with the replace()
method in order to replace everything after the 1st (first) whitespace , regardless of content and length. So the value of the variable phr
would be "moved up", and would be "stirred", eliminating everything from the first (blank) ie "up" would be eliminated in the given example. It is important that the deletion be performed using the replace()
method, as the substitution criterion must be the 1st (first) whitespace . Thanks in advance for your attention.
var phr = 'stirred up';