const array = [];let max = -11;let min = 11;let maxIndex, minIndex;
for (let i = 0; i < 10; i++) {array.push(Math.floor(Math.random() * 21) - 10);}
array.forEach((element, index) => {if (element > max) {max = element;maxIndex = index;}if (element < min) {min = element;minIndex = index;}});
console.log(Исходный массив: ${array.join(' ')});console.log(максимальный a[${maxIndex}] = ${max});console.log(минимальный a[${minIndex}] = ${min});
const array = [];
let max = -11;
let min = 11;
let maxIndex, minIndex;
for (let i = 0; i < 10; i++) {
array.push(Math.floor(Math.random() * 21) - 10);
}
array.forEach((element, index) => {
if (element > max) {
max = element;
maxIndex = index;
}
if (element < min) {
min = element;
minIndex = index;
}
});
console.log(Исходный массив: ${array.join(' ')});
console.log(максимальный a[${maxIndex}] = ${max});
console.log(минимальный a[${minIndex}] = ${min});