I want to save an array in an object in runtime through a loop.
For example, I take an input in an array inp=[2, 7, 20, 15, 19] and I want to save it in an obj={0:2, 1:7, 2:20, 3:15, 4:19}. But, at runtime such that I have a
for(i=0;i<inp.length;i++)
{ save each element of array into the respective object element }
The problem is that I have to save arrays of different lengths, these array come from taking an input from user.
I am also sorting the object afterwards and returning the indices in another array in my code. I am stuck only at how to save an array in an object during runtime. I searched a lot for a clue to get started but, I could not find anything.