diff --git a/index.html b/index.html
index b956b4d..fe8d50b 100644
--- a/index.html
+++ b/index.html
@@ -11,6 +11,8 @@
0
+
+
@@ -24,7 +26,7 @@
-
+
diff --git a/script.js b/script.js
index 4dd1e09..539a4e3 100644
--- a/script.js
+++ b/script.js
@@ -8,17 +8,27 @@ buttons.forEach((button) => {
function displayToScreen() {
-
if (this.className == "equal") {
let calc = new Calculator;
screen.textContent = calc.calculate(screen.textContent);
} else if (this.className == "clear") {
screen.textContent = "0";
+ } else if (this.className == "back") {
+ screen.textContent = screen.textContent.trimEnd()
+ screen.textContent = screen.textContent.slice(0, -1);
+
+ if (!isNaN(screen.textContent.charAt(-2))) {
+ screen.textContent = screen.textContent.trimEnd()
+ }
} else {
if (this.className == "operator") {
let screenContent = screen.textContent;
+ // Add some logic for handling negatives with -
+ // Handle decimals add 0 on a trailing decimal point
+ // Add key support
+
for (let i = 0; i < screenContent.length; i++ ) {
if (operators.includes(screenContent[i])) {
let calc = new Calculator;
diff --git a/style.css b/style.css
index 01f35dd..ccfd3fb 100644
--- a/style.css
+++ b/style.css
@@ -45,6 +45,11 @@ button {
font-size: 50px
}
+.clear, .back {
+ grid-column: span 2;
+ width: 205px;
+}
+
footer {
flex: 0 0 auto;
}
\ No newline at end of file