remove substring from end of string javascript code example Example: remove substring from string javascript var ret = "data-123".replace('data-','');