How can I pass value from html input to javascript I have value_1 = 0 but when I change it in input form I want code inside if to happen.
<body>
<input type="number" name="a" id="commands"><br>
<canvas id="myChart1"></canvas>
<script>
const value_1 = 0;
const value_1 = document.getElementById("commands").value;
if(value_1 != 0)
{
//code
}
</script>
</body>
const value_1 = 0;entirely because one line later you reassign the value ofvalue_1