Upstox Interview Question

Create a split function in javascript