I feel this is a basic problem but I am having a hard time coming up with a more elegant solution.

So my problem is that I have an array object with a field for Priority.

The priority would be sequential from 1 being the highest.

For example I have:

```
[{id: 1, priority: 1}, {id: 2, priority: 2}, {id: 3, priority: 3}]

```

Then I want to change the priority of id: 3 into 1 which the resulting array would be

```
[{id: 1, priority: 2}, {id: 2, priority: 3}, {id: 3, priority: 1}]

```

Right now my solution is looping the lenght of array starting with the Priority value that's going to be change and adding + 1. A lot of complication comes up with this approach and I feel I'm making it to complicated on what it should be