const gp = navigator.getGamepads()[0];
console.log(gp.connected);Gamepad: connected property / notebook
Gamepad: connected property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.