Remove portion of string in Javascript

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?

Answers


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

Need Your Help

Can Eclipse use the same sdk that Android Studio (intelliJ)?

eclipse sdk intellij-idea android-studio

I'm using Android Studio, but I need Eclipse at the moment. So, in Window > Preferences > Android, in SDK Location, I choose the sdk location inside my Android Studio folder, that is .../android-st...

Emitting namespace specifications with ElementTree in Python

python xml elementtree

I am trying to emit an XML file with element-tree that contains an XML declaration and namespaces. Here is my sample code: