samedi 21 mai 2022

Generate new order of numbers from array

I'm currently trying to generate a new order of numbers from a current array with numbers from 1 - 10.

For example, I have arrary like this:

data = [
    {
        0: 1,
        1: 2,
        2: 3,
        3: 4,
        4: 5,
        5: 6
    },
    {
        0: 1,
        1: 2,
        2: 3,
        3: 4,
        4: 5,
        5: 8
    }
]

And i'm trying to generate a new order from this array from numbers from 1 - 10.

For example: I want it to generate a new order like this:

    0: 1,
    1: 2,
    2: 3,
    3: 4,
    4: 5,
    5: 7 (The new number)

Where it checks the order of the array, and make a new order with numbers from 1 - 10




Aucun commentaire:

Enregistrer un commentaire