How Does The Splice Function Work In Javascript