Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added counter app js project #14

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
sandeepMcodeX wants to merge 1 commit into zpratikpathak:master
base: master
Choose a base branch
Loading
from sandeepMcodeX:js-counter-app

Conversation

@sandeepMcodeX
Copy link
Contributor

@sandeepMcodeX sandeepMcodeX commented Oct 16, 2025

No description provided.

Copy link
Owner

Hi @sandeepMcodeX , there is no Readme.md file in the folder
Also please add your project in root Readme.md too and have a look at the issues identified by Copilot

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new counter application project written in JavaScript. The application provides a simple interface for incrementing and decrementing a counter value with user-defined step amounts.

  • Creates a functional counter app with increment/decrement buttons
  • Implements custom step value input for flexible counting
  • Includes reset functionality to restore default values

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
30-counter-app/index.html HTML structure with counter display, control buttons, and step input
30-counter-app/script.js JavaScript logic for counter operations and event handling
30-counter-app/style.css CSS styling for the counter interface with button animations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +8 to +15
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
outputValue.innerText = resultValue - userInputValue;
});

increaseButton.addEventListener('click', () => {
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

parseInt() returns NaN when the input is invalid or empty, which will cause the counter to display NaN. Consider using parseInt() with a fallback value or validating the input first.

Suggested change
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
outputValue.innerText = resultValue - userInputValue;
});
increaseButton.addEventListener('click', () => {
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
const resultValue = Number.isNaN(parseInt(outputValue.innerText)) ? 0 : parseInt(outputValue.innerText);
const userInputValue = Number.isNaN(parseInt(userInput.value)) ? 1 : parseInt(userInput.value);
outputValue.innerText = resultValue - userInputValue;
});
increaseButton.addEventListener('click', () => {
const resultValue = Number.isNaN(parseInt(outputValue.innerText)) ? 0 : parseInt(outputValue.innerText);
const userInputValue = Number.isNaN(parseInt(userInput.value)) ? 1 : parseInt(userInput.value);

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +15
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
outputValue.innerText = resultValue - userInputValue;
});

increaseButton.addEventListener('click', () => {
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

parseInt() returns NaN when the input is invalid or empty, which will cause the counter to display NaN. Consider using parseInt() with a fallback value or validating the input first.

Suggested change
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
outputValue.innerText = resultValue - userInputValue;
});
increaseButton.addEventListener('click', () => {
const resultValue = parseInt(outputValue.innerText);
const userInputValue = parseInt(userInput.value);
let resultValue = parseInt(outputValue.innerText);
if (isNaN(resultValue)) resultValue = 0;
let userInputValue = parseInt(userInput.value);
if (isNaN(userInputValue)) userInputValue = 1;
outputValue.innerText = resultValue - userInputValue;
});
increaseButton.addEventListener('click', () => {
let resultValue = parseInt(outputValue.innerText);
if (isNaN(resultValue)) resultValue = 0;
let userInputValue = parseInt(userInput.value);
if (isNaN(userInputValue)) userInputValue = 1;

Copilot uses AI. Check for mistakes.
transition: all 0.1s;
-webkit-box-shadow: 0px 6px 0px #e62222;
-moz-box-shadow: 0px 6px 0px #e62222;
box-shadow: 0px 6px 0px #b20000;
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Inconsistent box-shadow colors for the reset button. The webkit and moz prefixes use #e62222 while the standard property uses #b20000, creating visual inconsistencies across browsers.

Suggested change
box-shadow: 0px 6px 0px #b20000;
box-shadow: 0px 6px 0px #e62222;

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +92
-webkit-box-shadow: 0px 2px 0px #e62222;
-moz-box-shadow: 0px 2px 0px #e62222;
box-shadow: 0px 2px 0px #e62222;
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Inconsistent box-shadow color for the reset button active state. The colors should match the inactive state pattern or use consistent colors across all three declarations.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /