JSFiddle - React, Tailwind, and code Playground

by ProJey

JavaScript

/* Задача №1 -------------------------------------------------------------------
var i = 0
var studentsAndPoints = [
  'Алексей Петров', 0,
  'Ирина Овчинникова', 60,
  'Глеб Стукалов', 30,
  'Антон Павлович', 30,
  'Виктория Заровская', 30,
  'Алексей Левенец', 70,
  'Тимур Вамуш', 30,
  'Евгений Прочан', 60,
  'Александр Малов', 0
];

var k = studentsAndPoints.length;
console.info('Список студентов:');
while(i<k) {
console.log('Студент '+ studentsAndPoints[i] + ' набрал ' + studentsAndPoints[i+1] + ' баллов')
i=i+2
}

Задача №2 ----------------------------------------------------------------------
console.info('Студент набравший максимальный балл:');
var k = studentsAndPoints.length;
var maxIndex = 1,
  	minIndex = 1,
		max = studentsAndPoints[maxIndex],
  	min = studentsAndPoints[minIndex];
for (var i = 3; i < k; i=i+2) {
  max = Math.max(max, studentsAndPoints[i]);
  min = Math.min(min, studentsAndPoints[i]);
  if (min === studentsAndPoints[i]) {
    minIndex = i;
  } else if (max === studentsAndPoints[i]) {
    maxIndex = i;
  }
}

console.log('Студент '+ studentsAndPoints[maxIndex-1] + ' имеет максимальный балл ' + studentsAndPoints[maxIndex]);

Задача №3 -----------------------------------------------------------------------
console.info('Новые студенты:');
studentsAndPoints.push('Николай Фролов');
studentsAndPoints.push(0);
studentsAndPoints.push('Олег Боровой');
studentsAndPoints.push(0);
var k = studentsAndPoints.length;
console.info('Список студентов:');
while(i<k) {
console.log('Студент '+ studentsAndPoints[i] + ' набрал ' + studentsAndPoints[i+1] + ' баллов')
i=i+2
}

Задача № 4 -------------------------------------------------------------------------
console.info('Увеличились баллы:');
studentsAndPoints.push('Николай Фролов');
studentsAndPoints.push(0);
studentsAndPoints.push('Олег Боровой');
studentsAndPoints.push(0);
var k = studentsAndPoints.length;

for (var i = 0; i < k; i = i + 2) {
  if (studentsAndPoints[i] === 'Антон Павлович') {
   ...