class Tax {
private vl1 = document.getElementById('input1') as HTMLInputElement | null;
private vl2 = document.getElementById('input2') as HTMLInputElement | null;
private vl3 = document.getElementById('input3') as HTMLInputElement | null;
private itogo: number;
public taxSum(hp: number, stavka: number, count: number): number {
this.itogo = hp * this.isStavka(stavka) * (count / 12);
console.log(this.itogo);
return this.itogo;
}
private isStavka(hp: number): number {
if (hp == 100) {
hp = 8;
}
if (hp > 100 && hp <= 150) {
hp = 34;
}
if (hp > 150 && hp <= 200) {
hp = 35;
}
return hp;
}
}
const tax = new Tax().taxSum(144, 144, 12);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="/index.js"></script>
<title>Document</title>
</head>
<body>
<input type="number" id="input1">
<input type="number" id="input2">
<input type="number" id="inpunt2">
</body>
</html>
<button id="btn">click!</button>
<input id="txt" type="text">
<script>
document.getElementById('btn').addEventListener('click',(e)=>{
console.log(document.getElementById('txt').value);});
</script>