Upstox interview question

Create a split function in javascript