Estoy haciendo una ejercicio de simulación básica de cajero.
me da el siguiente error al momento de ejecutar el código, no he podido encontrar el error.
Cannot read property 'addEventListener'
Agradeceré mucho su orientación, Gracias!
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>