mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2024-12-26 06:20:42 -05:00
commit
9f764ac71f
1 changed files with 11 additions and 6 deletions
|
@ -141,15 +141,18 @@ function handleOperatorClick(operatorClicked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ops.operator = operatorClicked;
|
ops.operator = operatorClicked;
|
||||||
//TODO fix this conditional should be if numFlag and a check if = or additional ops
|
//TODO fix this conditional should be if numFlag and a check if = or additional ops
|
||||||
if(!ops.onSecondNumber ){
|
if(!ops.onSecondNumber ){
|
||||||
ops.numFlag = true;
|
ops.numFlag = true;
|
||||||
} else if (ops.result !== undefined ) {
|
if (ops.result !== "" ) {
|
||||||
console.log('this is running the ops.result');
|
console.log('this is running the ops.result');
|
||||||
ops.firstNum = ops.result;
|
ops.firstNum = ops.result;
|
||||||
ops.onSecondNumber = true;
|
ops.onSecondNumber = true;
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ops.onSecondNumber = !ops.onSecondNumber;
|
ops.onSecondNumber = !ops.onSecondNumber;
|
||||||
}
|
}
|
||||||
|
@ -185,9 +188,11 @@ function negateNumber(){
|
||||||
|
|
||||||
function percentageNumber() {
|
function percentageNumber() {
|
||||||
let percent;
|
let percent;
|
||||||
if (!ops.numFlag || !ops.onSecondNumber) {
|
if ((!ops.numFlag || !ops.onSecondNumber)) {
|
||||||
percent = Number(ops.firstNum) / 100;
|
percent = Number(ops.firstNum) / 100;
|
||||||
ops.firstNum = String(percent);
|
ops.firstNum = String(percent);
|
||||||
|
} else if (ops.result !== "" ) {
|
||||||
|
percent = Number(ops.result) / 100;
|
||||||
} else {
|
} else {
|
||||||
percent = Number(ops.secondNum) / 100;
|
percent = Number(ops.secondNum) / 100;
|
||||||
ops.secondNum = String(percent);
|
ops.secondNum = String(percent);
|
||||||
|
|
Loading…
Reference in a new issue