File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,10 @@ document.addEventListener('DOMContentLoaded', function() {
10
10
11
11
function updateDisplay ( value ) {
12
12
if ( calculationJustCompleted && ! isNaN ( value ) && value !== "." ) {
13
- displayValue = "" ;
14
- calculationJustCompleted = false ;
13
+ resetDisplay ( ) ;
15
14
}
16
15
if ( displayValue === "0" && value !== "." ) {
17
16
displayValue = "" ;
18
- calculationJustCompleted = false ;
19
17
}
20
18
displayValue += value ;
21
19
if ( displayValue . length > MAX_DISPLAY_LENGTH ) {
@@ -24,6 +22,11 @@ document.addEventListener('DOMContentLoaded', function() {
24
22
displayOutput . textContent = displayValue ;
25
23
}
26
24
25
+ function resetDisplay ( ) {
26
+ displayValue = "" ;
27
+ calculationJustCompleted = false ;
28
+ }
29
+
27
30
function clearDisplay ( ) {
28
31
displayValue = "0" ;
29
32
firstNumber = "" ;
You can’t perform that action at this time.
0 commit comments