Skip to content

Update scripts.js #1197

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update scripts.js #1197

wants to merge 1 commit into from

Conversation

Om149
Copy link

@Om149 Om149 commented Aug 2, 2025

✨ Code Refactor: JavaScript Calendar

  • Replaced all let with const where values don't change
  • Cached DOM elements at top for readability and performance
  • Added DOMContentLoaded event to ensure calendar loads properly
  • Simplified next() and previous() functions
  • Improved input validation in jump() to prevent NaN errors
  • Used textContent instead of innerHTML or appendChild with text nodes
  • Improved formatting and added spacing for clarity

This improves the code's readability, performance, and makes it easier to maintain and extend in the future.

Developer Checklist

  • Followed guidelines mentioned in the readme file.
  • Followed directory structure. (e.g. ProjectName/{USERNAME}/...yourfiles)
  • Starred ⭐ the Repo (Optional)

Summary

add a summary here

Screenshot

attach screenshots/gifs here

Live Project Link

add a working project link here

✨ Code Refactor: JavaScript Calendar

- Replaced all `let` with `const` where values don't change
- Cached DOM elements at top for readability and performance
- Added `DOMContentLoaded` event to ensure calendar loads properly
- Simplified `next()` and `previous()` functions
- Improved input validation in `jump()` to prevent NaN errors
- Used `textContent` instead of `innerHTML` or `appendChild` with text nodes
- Improved formatting and added spacing for clarity

This improves the code's readability, performance, and makes it easier to maintain and extend in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant