nEmEc,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div>
<label>
Число 1:
<input type="number" id="numberA">
</label>
</div>
<div>
<label>
Число 2:
<input type="number" id="numberB">
</label>
</div>
<div>
Попыток:
<input type="number" id="popytki">
</div>
<div>
<button onclick="data1 = allFunction(); console.log (data1);">Попробовать</button>
</div>
<script>
function allFunction() {
function getFormValueA() {
let a = document.getElementById('numberA').value;
return a;
};
let a = getFormValueA();
function getFormValueB() {
let b = document.getElementById('numberB').value;
return b;
};
let b = getFormValueB();
function getPopytkiValue() {
let c = document.getElementById('popytki').value;
return c;
};
let c = getPopytkiValue();
let data = {
chislo_1: a,
chislo_2: b,
popytki: c,
};
return data;
};
let data1 = allFunction();
</script>
</body>
</html>