Skip to content

simple calculator by beny#6

Open
beny25585 wants to merge 1 commit into
ColmanDevClubORG:mainfrom
beny25585:beny
Open

simple calculator by beny#6
beny25585 wants to merge 1 commit into
ColmanDevClubORG:mainfrom
beny25585:beny

Conversation

@beny25585

Copy link
Copy Markdown

No description provided.

@beny25585 beny25585 changed the title sןmple calculator by beny simple calculator by beny Nov 29, 2025

@GilHeller GilHeller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job. Please see my comments

Comment thread .vscode/launch.json
Comment on lines +2 to +4
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove redundant comments

Comment thread index.html
Comment on lines +14 to +28
<div class="row">
<button class="number" id="number-7">7</button>
<button class="number" id="number-8">8</button>
<button class="number" id="number-9">9</button>
</div>
<div class="row">
<button class="number" id="number-4">4</button>
<button class="number" id="number-5">5</button>
<button class="number" id="number-6">6</button>
</div>
<div class="row">
<button class="number" id="number-1">1</button>
<button class="number" id="number-2">2</button>
<button class="number" id="number-3">3</button>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider to inject the elements using a loop.

Comment thread script.js

numbers.forEach((num) => {
num.addEventListener("click", () => {
if (flag == true) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use === for comparisons instead of ==.
The === compares also type.
I this case,

1 == true // will also return true

Comment thread script.js

let calcArray = [];
let bigNumber = "";
let flag = false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use descriptive, meaningful variable names.
The variable name flag is unclear and doesn’t convey its purpose.

Comment thread script.js
Comment on lines +103 to +105
let num1 = Number(array[0]);
let op = array[1];
let num2 = Number(array[2]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The assignment is redundant. You may want to use a global variables rather than an array.

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.

2 participants