HTML Diff
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 &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); /* console.log(usersByDay); currentIndex = 0; minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); */ /* console.log(usersByDay); currentIndex = 0; minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); */</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 &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); /* console.log(usersByDay); currentIndex = 0; minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); */ /* console.log(usersByDay); currentIndex = 0; minValue = usersByDay[currentIndex]; for (var j = currentIndex + 1; j &lt;= usersByDay.length - 1; j++) { if (usersByDay[j] &lt; minValue) { minValue = usersByDay[j]; var swap = usersByDay[currentIndex]; usersByDay[currentIndex] = minValue; usersByDay[j] = swap; console.log('Swapping ' + swap + ' and ' + minValue); console.log('Current array: ' + usersByDay); } } console.log('Minimum element ' + minValue + ' is on ' + currentIndex + ' position'); */</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>Uncomment the first block of the code.</li>
6 <ol><li>Uncomment the first block of the code.</li>
7 <li>In the uncommented code, change the value currentIndex to 1.</li>
7 <li>In the uncommented code, change the value currentIndex to 1.</li>
8 <li>Uncomment the second block of the code.</li>
8 <li>Uncomment the second block of the code.</li>
9 <li>In the uncommented code, change the value currentIndex to 2.</li>
9 <li>In the uncommented code, change the value currentIndex to 2.</li>
10 </ol>
10 </ol>