JavaScript – How to Remove a Portion of a String

javascriptstring

I have a String like this in Javascript:

string = '@usernameWhats on your mind?'

I need to get rid of 'Whats on your mind?' from the string.

How would I do that?

Best Answer

var new_string = string.replace('Whats on your mind?', '');
Related Question