I'm doing a basic cashier simulation exercise .
I get the following error when executing the code, I could not find the error.
Can not read property 'addEventListener'
I would greatly appreciate your guidance, Thanks!
JS :
class billete{
constructor(v,c){
this.valor=v;
this.cantidad=c;
}
}
function entregarDinero()
{
for(var bi of caja)
{
console.log(bi);
}
}
var caja=[];
var entregado=[];
caja.push(new billete(50,3));
caja.push(new billete(20,2));
caja.push(new billete(10,2));
var dinero=210;
var div=0;
var papeles=0;
var b=document.getElementById("extraer");
b.addEventListener("click", entregarDinero);
HTML
<!DOCTYPE html>
<html>
<head>
<title>Cajero</title>
</head>
<body>
<h1>Mi primer cajero!</h1>
<p> wow! :O </p>
<img src="cajero.webp">
</br>
<script src="cajero.js"></script>
<input type="number" id="dinero">
<input type="button" value="Extraer" id="extraer" />
</body>
</html>