Use Variable Inside String Javascript Substring Until Character