How To Insert Variable Into String Javascript Substring Until Character