let gp = navigator.getGamepads()[0]; // Get the first gamepad object
if (gp.buttons[0].pressed) {
// respond to button being pressed
}GamepadButton: pressed property / notebook
GamepadButton: pressed property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.