The following js code fails in developer console of firefox, chrome and nodejs as well. Unable to figure out why?
function* x() {}
let y = x()
setTimeout(y.next, 100)
Error in firefox
TypeError: CallGeneratorMethodIfWrapped method called on incompatible Window
Error in chrome
Uncaught TypeError: Method [Generator].prototype.next called on incompatible receiver # at next ()
Error in node.js
timers.js:475
timer._onTimeout();
^
TypeError: Method [Generator].prototype.next called on incompatible receiver #<Timeout>
at Timeout.next [as _onTimeout] (<anonymous>)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)