Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript code optimization #82

Open
lucky-sideburn opened this issue Oct 16, 2024 · 2 comments
Open

JavaScript code optimization #82

lucky-sideburn opened this issue Oct 16, 2024 · 2 comments

Comments

@lucky-sideburn
Copy link
Owner

lucky-sideburn commented Oct 16, 2024

Please review kubeinvaders.js and open me solvable issue to improve code

@lucky-sideburn lucky-sideburn changed the title JavaScript code and UI optimization JavaScript code optimization Oct 16, 2024
@P0203K
Copy link
Contributor

P0203K commented Oct 16, 2024

Some solvable issues:

  1. Remove Duplicate Code for Repeated XMLHttpRequest Calls
  2. Reduce Use of Global Variables
  3. Replace var with const and let to avoid unintended bugs due to hoisting or scope.
  4. Use Caching for DOM Element Lookups. Repeated use of document.getElementById() and jQuery lookups is inefficient.
  5. Instead of constantly redrawing all aliens, only update and draw what has changed. Use a flag to track if positions or states have changed before redrawing.

@lucky-sideburn
Copy link
Owner Author

Dear @P0203K

Thank you! I would like to start from reducing global variables. I will let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants