Skip to content

Commit 85e5da3

Browse files
committed
feat(JS): add an if statement for when user press Enter key
1 parent 5b3b80e commit 85e5da3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function handleKeyPress(event) {
1717
const key = event.key;
1818
const button = document.querySelector(`[data-value="${key}"]`);
1919

20+
21+
2022
if (button) {
2123
button.click(); // Trigger the click event for the corresponding button
2224
}
@@ -30,10 +32,9 @@ function handleKeyPress(event) {
3032
}
3133
}
3234

33-
34-
35-
36-
35+
if(event.code === "Enter") {
36+
userClicksOnEqualButton("=");
37+
}
3738

3839
}
3940

0 commit comments

Comments
 (0)