Just a guess - I'd put line 10 with the w.on setup above the w.startOutput(BZ, 4000); so the event handler is registered before it is started.
w.on
w.startOutput(BZ, 4000);
@fanoush started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just a guess - I'd put line 10 with the
w.on
setup above thew.startOutput(BZ, 4000);
so the event handler is registered before it is started.