Create Element And Set Attributes Javascript Array Splice