1
0
This commit is contained in:
2024-05-23 18:54:11 +03:00
parent 6fcee9ce9b
commit f6806d8a5a
2 changed files with 22 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Books Information</title>
<title>Лабораторная работа No6</title>
<style>
table {
border-collapse: collapse;
@@ -176,7 +176,7 @@
tableBody.appendChild(row);
});
const json = JSON.stringify(books);
const json = JSON.stringify(books, null, 2);
document.getElementById("json").value = json;
}

View File

@@ -42,6 +42,11 @@
<button onclick="run()">Выполнить</button>
</div>
<div>
<h3>Результат:</h3>
<div id="result"></div>
</div>
<script src="script.js"></script>
<script>
function run() {
@@ -74,15 +79,27 @@
func = countCalls(func);
characteristics = [];
if (isFindMin)
names = []
if (isFindMin) {
characteristics.push(findMin);
if (isCountPositive)
names.push('Минимум');
}
if (isCountPositive) {
characteristics.push(countPositive);
if (isIsMonotonous)
names.push('Кол-во положительных');
}
if (isIsMonotonous) {
characteristics.push(isMonotonous);
names.push('Монотонность');
}
const chars = calculateCharacteristics(func, Number(xMin), Number(xMax), Number(h), characteristics);
console.log(chars);
const result = document.getElementById('result');
names.forEach((name, index) => {
result.innerHTML += name + ': ' + chars[index] + '<br>';
})
}
</script>
</body>