how to add to a index on array on creation in javascript code example Example: javascript add array to array at index a1.splice(2, 0, ...a2);