I have created a key value pair in Angular. The key represents the questionId and the value is the baseQuestion. The baseQuestion value may be null. One issue I am facing is that after insertion, the key value pairs are automatically sorted in ascending order of the keys. However, I would like to maintain the insertion order. If achieving this is not possible with the current implementation, how could we go about achieving it? Here is my code snippet so far:
for (let i = 0; i < this.questions.length; i++){
let j= this.questions[i]['questionId'];
qnKeyValue[j]= (this.questions[i]['baseQuestion'] == undefined ?null : this.questions[i]['baseQuestion']);
}