Javascript Splice Method On Arraylist Set Function In R Language