You can create a simple keylogger in JavaScript. It listens for key presses and logs them:

- document.addEventListener('keydown', ...): Listens for any key press on the page.
- event.key: Captures which key was pressed.
- console.log(): Logs the key to the browser's console.
To run this JavaScript keylogger, follow these steps:
- Right-click anywhere on a webpage.
- Select "Inspect" or press F12.
- Go to the "Console" tab.
Copy and paste this code into the console:

After running the script, start typing on the webpage. Each key press will be logged in the console, showing messages like:
Key pressed: H
Key pressed: e
Key pressed: l
Key pressed: l
Key pressed: o