[javascript] Getting the last element of a split string array