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

Tell us what’s happening:

I dont understand what I’m doing wrong in this step.

Your code so far

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

/* file: styles.css */

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

const selectionSort = (array) => {
  for (let i = 0; i < array.length; i++) {
    let minIndex = i;
    for (let j=i+1; j<i+1;j++){}

  }
  


// User Editable Region

Your browser information:

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

Challenge Information:

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

this for loop is not really working because it starts at j=i+1 but the limitant condition is j<i+1.

pay attention that it should start with j=i+1 indeed, but iterate through the rest of the array.

How do I make it iterate through the rest of the array

in this for-loop, for example, you iterate from 0 through the end of the array.
you need something like this for the second for-loop, only starting in i+1 instead of 0

for (let j=i+1; j>i+1; j++){}
This is what I have.

Got it. Thank you so much

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.