Compare commits
No commits in common. "21c57e28f9005572c33a0497e10d3d6a15b4c774" and "47adcfbe58c5f20ab74a113292ecfb132d2d2602" have entirely different histories.
21c57e28f9
...
47adcfbe58
24
index.html
24
index.html
|
@ -13,6 +13,30 @@
|
|||
<div id="container">
|
||||
<div id="view"></div>
|
||||
<div id="buttons">
|
||||
<!-- <div class="buttons-flex">
|
||||
<div class="button">7</div>
|
||||
<div class="button">8</div>
|
||||
<div class="button">9</div>
|
||||
<div class="button">/</div>
|
||||
</div>
|
||||
<div class="buttons-flex">
|
||||
<div class="button">4</div>
|
||||
<div class="button">5</div>
|
||||
<div class="button">6</div>
|
||||
<div class="button">+</div>
|
||||
</div>
|
||||
<div class="buttons-flex">
|
||||
<div class="button">1</div>
|
||||
<div class="button">2</div>
|
||||
<div class="button">3</div>
|
||||
<div class="button">-</div>
|
||||
</div>
|
||||
<div class="buttons-flex">
|
||||
<div class="button">0</div>
|
||||
<div class="button">.</div>
|
||||
<div class="button">=</div>
|
||||
<div class="button">*</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
33
script.js
33
script.js
|
@ -28,18 +28,18 @@ function operate(equals) {
|
|||
}
|
||||
|
||||
function execute(operation) {
|
||||
if (operation.equal) {
|
||||
const result = operate(operation);
|
||||
operation.a_b = !operation.a_b;
|
||||
operation.equal = false;
|
||||
operation.operator = "";
|
||||
if (operation.a_b) {
|
||||
operation.a = `${result}`;
|
||||
operation.b = "";
|
||||
}
|
||||
console.table(operation);
|
||||
console.log(`Result: ${result}`);
|
||||
const result = operate(operation);
|
||||
if ("" in operation) {
|
||||
console.log("BLANK IS HERE");
|
||||
}
|
||||
operation.a_b = !operation.a_b;
|
||||
operation.operator = "";
|
||||
if (operation.a_b) {
|
||||
operation.a = `${result}`;
|
||||
operation.b = "";
|
||||
}
|
||||
console.table(operation);
|
||||
console.log(`Result: ${result}`);
|
||||
}
|
||||
|
||||
let operation = {
|
||||
|
@ -47,7 +47,6 @@ let operation = {
|
|||
operator: "",
|
||||
b: "",
|
||||
a_b: true,
|
||||
equal: false,
|
||||
}
|
||||
|
||||
let equal = "";
|
||||
|
@ -58,20 +57,20 @@ function click(value) {
|
|||
operation.a += value;
|
||||
} else {
|
||||
operation.b += value;
|
||||
operation.equal = true;
|
||||
}
|
||||
} else if (value == "=") {
|
||||
execute(operation);
|
||||
} else {
|
||||
if (operation.operator == "") {
|
||||
operation.a_b = !operation.a_b;
|
||||
operation.operator = value;
|
||||
}
|
||||
if (operation.a_b) {
|
||||
operation.operator = value;
|
||||
}
|
||||
operation.operator = value;
|
||||
}
|
||||
console.table(operation);
|
||||
|
||||
if ("" in operation) {
|
||||
console.log("BLANK IS HERE");
|
||||
}
|
||||
}
|
||||
|
||||
function generateGui() {
|
||||
|
|
Loading…
Reference in New Issue