Skip to content

Commit b9e488e

Browse files
committed
feat(JS): correct typo
1 parent daf683d commit b9e488e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function userClicksOnEqualButton(button) {
191191
screen.innerText = "0÷0 is an invalid format. Press AC";
192192
} else {
193193
let result = eval(replacedArray.join(""));
194-
let historyEntries = [[...replacedArray, "=", result]]; // Used slice() at firest. But slice() is not sufficient because it only creates a shallow copy of the array, and modifications to the new array will still affect the original array. The spread syntax ([...replacedArray]), which creates a shallow copy as well, is a concise way to create a new array with the same elements as the existing array. While ensuring that modifications to historyEntries do not affect replacedArray, and vice versa.
194+
let historyEntries = [[...replacedArray, "=", result]]; // Used slice() at first. But slice() is not sufficient because it only creates a shallow copy of the array, and modifications to the new array will still affect the original array. The spread syntax ([...replacedArray]), which creates a shallow copy as well, is a concise way to create a new array with the same elements as the existing array. While ensuring that modifications to historyEntries do not affect replacedArray, and vice versa.
195195
replacedArray.splice(replacedArray.length, 0, "=", result);
196196
displayResult(replacedArray, result);
197197
screen.innerText = !Number.isFinite(result)

0 commit comments

Comments
 (0)