0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<ul><li>script.js</li>
1
<ul><li>script.js</li>
2
</ul><p>JavaScript</p>
2
</ul><p>JavaScript</p>
3
<p>var usersByDay = [4, 2, 1, 3]; console.log(usersByDay); var currentIndex = 0; var minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j <= usersByDay.length - 1; j++) { if (usersByDay[j] < minValue) { minValue = usersByDay[j]; } } console.log('Minimum element: ' + minValue);</p>
3
<p>var usersByDay = [4, 2, 1, 3]; console.log(usersByDay); var currentIndex = 0; var minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j <= usersByDay.length - 1; j++) { if (usersByDay[j] < minValue) { minValue = usersByDay[j]; } } console.log('Minimum element: ' + minValue);</p>
4
<p>Thanks! We’ll fix everything at once!</p>
4
<p>Thanks! We’ll fix everything at once!</p>
5
<h2>Result</h2>
5
<h2>Result</h2>
6
<ol><li>Inside the condition after the variable minValue, save the value usersByDay[currentIndex] to variable swap. Write the remaining code inside the condition.</li>
6
<ol><li>Inside the condition after the variable minValue, save the value usersByDay[currentIndex] to variable swap. Write the remaining code inside the condition.</li>
7
<li>On the next line in usersByDay[currentIndex], write down the minimum value.</li>
7
<li>On the next line in usersByDay[currentIndex], write down the minimum value.</li>
8
<li>Then write value of variable swap in usersByDay[j].</li>
8
<li>Then write value of variable swap in usersByDay[j].</li>
9
<li>On the next line, log in the console: 'Swapping ' + swap + ' and ' + minValue.</li>
9
<li>On the next line, log in the console: 'Swapping ' + swap + ' and ' + minValue.</li>
10
<li>Below, log in the console: 'Current array: ' + usersByDay.</li>
10
<li>Below, log in the console: 'Current array: ' + usersByDay.</li>
11
</ol>
11
</ol>