dev-AshishRanjan / Hacktoberfest-Frontend

Make your Pull Request for Hacktoberfest 2023 in the Web domain specially Frontend. And give this repo a ⭐
https://frontend-database.netlify.app
MIT License
14 stars 37 forks source link

Typing Progress Bar #24

Closed Mefisto04 closed 9 months ago

Mefisto04 commented 9 months ago

Describe your change:

Checklist:

ATTACH SCREEN-SHOTS

Before After
< Before Image > < After Image >
netlify[bot] commented 9 months ago

Deploy Preview for frontend-database ready!

Name Link
Latest commit c5ab7a2a481c37a68f3ad4d365c4653d5e711e28
Latest deploy log https://app.netlify.com/sites/frontend-database/deploys/652189d0963fb50008f1ce29
Deploy Preview [https://deploy-preview-24--frontend-database.netlify.app/projects/typing progress bar](https://deploy-preview-24--frontend-database.netlify.app/projects/typing progress bar)
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pr-explainer-bot[bot] commented 9 months ago

Pull Request Report

Hey there! I've created a report for your pull request. Let's dive in!

Changes

  1. Added a new project "Typing Progress Bar" to the ProjectList.json file.
  2. Added a new HTML file index.html for the "Typing Progress Bar" project.
  3. Added a new JavaScript file script.js for the "Typing Progress Bar" project.
  4. Added a new CSS file styles.css for the "Typing Progress Bar" project.

Suggestions to Improve Code

  1. Consider using more descriptive variable names in the script.js file. For example, instead of wordDisplay, you could use typingDisplay to make it clearer.
  2. Add comments to explain the purpose and functionality of different sections of code, especially in the script.js file.
  3. Use consistent indentation throughout the codebase to improve readability.

Bugs

No bugs found.

Improvements

  1. Move the CSS styles from the styles.css file to an external file or use inline styles for better separation of concerns.
  2. Consider using a CSS preprocessor like Sass or Less to make the styling code more maintainable and reusable.

Code Refactoring

In the script.js file, the following code snippet can be refactored for better readability:

wordInput.addEventListener('input', function () {
    const inputText = wordInput.value;
    const expectedWord = wordsArray[currentWordIndex];

    if (inputText === expectedWord) {
        currentWordIndex++;
        wordInput.value = '';
        updateProgressBar();

        if (currentWordIndex === wordsArray.length) {
            alert('Congratulations! You typed all the words correctly.');
        } else {
            wordDisplay.textContent = wordsArray[currentWordIndex];
        }
    }
});

Rating

I would rate the code a 7 out of 10 based on the following criteria:

That's it for the report! Let me know if you need any further assistance. Keep up the good work! 👍