I have been trying to solve this program. I have a list of objects that look like this. Adding elements to an array based on their index position.
let A = {index: 0}
let B = {index: 0}
let C = { index: 2}
let D = {index: 2}
let E = { index: 1}
So if A get pushed inside the array it takes over an array index position 0. However, when B get pushed in the array, it will take over an index position. [B, A], and so on. It is sort of like first go in, first come out, except get shifted to the left. However, I want to do something like this. [B, A, C], I want to add D to index position of C. [B, A, D, C]. A is at index position 1. I want to insert E to index 1. [B, E, A, D, C]
Array.concat(). Also please include the code you currently have when posting a question.