simple calculator by beny#6
Open
beny25585 wants to merge 1 commit into
Open
Conversation
GilHeller
reviewed
Dec 7, 2025
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 |
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> |
There was a problem hiding this comment.
Consider to inject the elements using a loop.
|
|
||
| numbers.forEach((num) => { | ||
| num.addEventListener("click", () => { | ||
| if (flag == true) { |
There was a problem hiding this comment.
Use === for comparisons instead of ==.
The === compares also type.
I this case,
1 == true // will also return true|
|
||
| let calcArray = []; | ||
| let bigNumber = ""; | ||
| let flag = false; |
There was a problem hiding this comment.
Use descriptive, meaningful variable names.
The variable name flag is unclear and doesn’t convey its purpose.
Comment on lines
+103
to
+105
| let num1 = Number(array[0]); | ||
| let op = array[1]; | ||
| let num2 = Number(array[2]); |
There was a problem hiding this comment.
The assignment is redundant. You may want to use a global variables rather than an array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.