Skip to content
Advertisement

Tag: gamepad-api

HTML5 Gamepad API TypeError

I’m trying to write some code to get a gamepad and list the axes’ position: and get an Uncaught TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator)) . Would really appreciate help. Answer getGamepads returns sequence<Gamepad?>. You’re using destructuring assignment syntax to unpack it into a variable. This doesn’t work because you’re trying to unpack getGamepads()[0] which is

Advertisement