Skip to content

Commit

Permalink
[NC] Decimal Result DONE
Browse files Browse the repository at this point in the history
  • Loading branch information
SNP0301 committed Oct 11, 2023
1 parent 95709c7 commit 8465f43
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ const typeNumberMatchingError = [

function onFormSubmit(event) {
event.preventDefault();
console.log(typeof fromNumber.value);
console.log("DECIMAL RESULT: " + calculateDecimal(fromNumber.value));
decimalResult = calculateDecimal(fromNumber.value);
console.log("TOTAL RESULT: " + calculateResult(decimalResult, toType.value));
}

function calculateDecimal(fromNumber) {
event.preventDefault();
if (fromType.value === "Binary") {
Expand Down Expand Up @@ -87,7 +89,6 @@ function binaryToDecimal(b) {
}
return d;
}

function octalToDecimal(o) {
d = 0;
o = o.toString();
Expand All @@ -96,5 +97,10 @@ function octalToDecimal(o) {
}
return d;
}
function calculateResult(inputDecimal, outputType) {
if (outputType == "Decimal") {
return inputDecimal;
}
}

form.addEventListener("submit", onFormSubmit);

0 comments on commit 8465f43

Please sign in to comment.