Interactive online courses HTML Academy
2026-03-09 12:25 Diff
  • script.js

JavaScript

var usersByDay = [4, 2, 1, 3]; console.log(usersByDay); var currentIndex = 0; for (var j = currentIndex + 1; j <= usersByDay.length - 1; j++) { console.log(usersByDay[j]); }

Thanks! We’ll fix everything at once!

Result

  1. After the variable currentIndex, add a variable minValue with the value usersByDay[currentIndex].
  2. Then in the loop, delete console log and add condition usersByDay[j] < minValue.
  3. When the condition is met, assign variable minValue value of the j-th element of the array.
  4. And in the same place log the following message in the console: 'New minimum element: ' + minValue.
  5. After the loop, log this message in the console: 'Minimum element: ' + minValue.