# Learn Basic Algorithmic Thinking by Building a Number Sorter - Step 38

### Tell us what’s happening:

const insertionSort = (array) => {
for (let i = 1; i < array.length; i++) {
const currValue = array[i];
let j = i - 1;

``````while (j >= 0 && array[j] > currValue) {
array[j] = j+1;
j--;
}
``````

}
}

``````<!-- file: index.html -->

``````
``````/* file: styles.css */

``````
``````/* file: script.js */
// User Editable Region

const insertionSort = (array) => {
for (let i = 1; i < array.length; i++) {
const currValue = array[i];
let j = i - 1;

while (j >= 0 && array[j] > currValue) {
array[j] = j+1;
j--;
}
}
}

// User Editable Region
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36`

### Challenge Information:

Learn Basic Algorithmic Thinking by Building a Number Sorter - Step 38

Hello;

The step says,

Do so by assigning the value at the `j` index to the next index.

You should take the value of the element at the `j` index from the array and assign it to the next index. However, you are assigning the directly `j+1` value to your `j` indexed element.

Before decrementing `j`, assign the value at `j` to the index `j + 1`.

You are assigning the wrong way around.

Also, how is this accessing the index?

Happy coding

Reverse your line of code: `removed`

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.