<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
const min = function (array) {
let min = array[0];
for (let i = 1; i < array.length; i++) {
if (min > array[i]) {
min = array[i];
}
}
return min;
}
const max = function (array) {
let max = array[0];
for (const item of array) {
if (max < item) {
max = item;
}
}
return max;
}
const testArray = [52, 273, 32, 103, 275, 24, 57];
document.write(`${testArray}중에서 <br>`);
document.write(`최소값 = ${min(testArray)}<br>`);
document.write(`최대값 = ${max(testArray)}`);
</script>
</body>
</html>