Javascript substring before character. The example below is similar to what I … to call string