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

Tell us what’s happening:

Created a nested for loop .Trying to check code error and cant find it.Any help?

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; j< array.length; 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/123.0.0.0 Safari/537.36 Edg/123.0.0.0

Challenge Information:

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

" This loop needs to start at the index after i"

so j = i should actually be j = i + 1

Good luck!

Do you mean I adjust the position of my nested for loop?I have adjusted the changes still get some syntax error.Cant progress still.

No your layout was fine, you don’t need to move things around. It’s a line specific change that should occur in this line here

      for (let j= i; j< array.length; j++) {

let j = i should actually be let j = i + 1

Does that make sense?

1 Like

Have you got the same number of closing curly brackets as opening ones?

1 Like

Curly braces were slowing me there.Plus @rustedviking I corrected my code.Thank you.