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

Tell us what’s happening:

Hi all, I cannot see where my mistake is. Error message says " Your while loop should have a condition that checks the value of array[j] is greater than currValue."

Your code so far

Here is my code 
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, j--){


The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0

Challenge Information:

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


decrement j inside the loop, not in the condition, and remember you need double minus for a correct syntax.

I am also being hiddered by the fCC tests!
try this:

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

Though, my error is with decrementing ‘j’ ; the fCC tests state, " Your while loop should decrement j inside the loop."
Which I have clearly done!
I sincerely hope that someone @pkdvalis @ilenia from fCC can Fully explain why the testing procedure is not accepting the code?!

fCC Beta DSA JS Number Sorter

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Did this work for you?

Please open a new topic for help with your code. That said, the instructions don’t ask for this line:

array[j + 1] = array[j];

Please stop @ ing mods and complaining about the tests. It’s pointless and disruptive. Thank you!