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

updated the script.js file #3109

Merged
merged 1 commit into from May 12, 2024
Merged

updated the script.js file #3109

merged 1 commit into from May 12, 2024

Conversation

Singh-Divyansh
Copy link
Contributor

@Singh-Divyansh Singh-Divyansh commented May 11, 2024

PR Description ๐Ÿ“œ

In the optimized code:

  1. Variable Declarations: I declared the myName variable using let instead of var for better scoping.

  2. Query Selector: I used document.querySelector('audio') to select the audio element instead of document.getElementsByTagName('audio')[0]. This method is more concise and modern.

  3. Event Listener Addition: I replaced onclick with addEventListener for buttons like 'hide', 'about', and 'show keyboard'. This is the recommended way to add event listeners in modern JavaScript.

  4. Special Character Handling: I improved the handling of special characters by using a regular expression test (/^[a-zA-Z0-9]$/) instead of checking individual key codes. I also utilized an object (specialChars) to map special key codes to their respective characters.

  5. Mute Button Logic: I simplified the logic for the mute button by toggling the audioPlayer.muted property directly within the event listener.

  6. Miscellaneous:

    • Removed unnecessary comments and redundant code.
    • Utilized querySelector and addEventListener consistently throughout the code for better readability and maintainability.

Fixes #3108

Mark the task you have completed โœ…

  • I follow CONTRIBUTING GUIDELINE & CODE OF CONDUCT of this project.
  • I have performed a self-review of my own code or work.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generates no new warnings.
  • I have followed proper naming convention showed in CONTRIBUTING GUIDELINE
  • I have added screenshot for website preview in assets/images
  • I have added entries for my game in main README.md
  • I have added README.md in my folder
  • I have added working video of the game in README.md (optional)
  • I have specified the respective issue number for which I have requested the new game.

Add your screenshots(Optional) ๐Ÿ“ธ



Thank you soo much for contributing to our repository ๐Ÿ’—

@kunjgit
Copy link
Owner

kunjgit commented May 11, 2024

Thank you @Singh-Divyansh ,for creating the PR and contributing to our GameZone ๐Ÿ’—
Review team will review the PR and will reach out to you soon! ๐Ÿ˜‡
Make sure that you have marked all the tasks that you are done with โœ….
Thank you for your patience! ๐Ÿ˜€

Copy link
Owner

@kunjgit kunjgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kunjgit kunjgit added level1 Documentation and small bug fixes in gssoc gssoc GSSoC24 program label labels May 12, 2024
@kunjgit kunjgit merged commit c1f0c02 into kunjgit:main May 12, 2024
3 checks passed
@kunjgit
Copy link
Owner

kunjgit commented May 12, 2024

Thank you @Singh-Divyansh , for your valuable time and contribution in our GameZone ๐Ÿ’—.
Itโ€™s our GameZone, so Letโ€™s build this GameZone altogether !!๐Ÿค
Hoping to see you soon with another PR again ๐Ÿ˜‡
Wishing you all the best for your journey into Open Source๐Ÿš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc GSSoC24 program label level1 Documentation and small bug fixes in gssoc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Update in Alphabet_Learning_Game
2 participants