Skip to content

Commit

Permalink
use event.key
Browse files Browse the repository at this point in the history
  • Loading branch information
Samq64 committed Dec 18, 2023
1 parent 95fe600 commit d2d164e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions content/docs/develop/userscripts/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ reportButton.addEventListener("click", (event) => {

- Prefer newer APIs, such as `fetch()` over `XMLHttpRequest`.
- Never use `==` for comparisons. Use `===` instead.
- Avoid `keyCode`, use `event.key` instead.
- Use optional chaining if an object can sometimes be `null`.
For example, `document.querySelector(".remix-button")?.textContent`.
- Use `for ... of` loops or `.forEach()`.
Expand Down

0 comments on commit d2d164e

Please sign in to comment.