So here's the deal see this code?
i want to make "b" be 0 whenever the variable reaches a number under 0, like a fixed value, but i dont know why its not working
Code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h3><button onclick="a"> Aki attack</button> Aki hp <span id="b"> 200 </span></h3>
<h3><button onclick="c (1)">Dark attack</button>Dark HP <span id="d"> 3500</span></h3>
<script>
var b=200;
var d=3500;
function c (number) {
b = b - 100;
document.getElementById ("b").innerHTML =b;
};
if (b < 0) {console.log(Math.sign(0));};
</script>
</body>
</html>
Comment