From 634ccd8b20eb4ad87e4737685df865090b79a5b9 Mon Sep 17 00:00:00 2001 From: Biswasindhu Mandal Date: Thu, 9 May 2024 23:32:26 +0530 Subject: [PATCH] update UI --- converter.html | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ src/converter.js | 42 ++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 converter.html create mode 100644 src/converter.js diff --git a/converter.html b/converter.html new file mode 100644 index 0000000..952f9c6 --- /dev/null +++ b/converter.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + Round-Off Rules + + + + +
+
+
+
+ +

Round Off Decimal Number

+ + + Biswasindhu Mandal + + +
+
+
+
+
+

Billion, Million, Trillion Converter

+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/converter.js b/src/converter.js new file mode 100644 index 0000000..a0f553e --- /dev/null +++ b/src/converter.js @@ -0,0 +1,42 @@ + + + +// ------------------------------ +const jsonList = { + western: { + 'M': 1000000, + 'B': 1000000000, + 'T': 1000000000000 + }, + indian: { + 'L': 100000, + 'C': 10000000 + } +}; + +function onConvert() { + const wVal = { + val: document.getElementById('numberVal').value, + type: document.getElementById('w_TypeVal').value + }; + const iVal = { + val: document.getElementById('i_number').value, + type: document.getElementById('i_TypeVal').value + }; + + console.log(wVal, iVal); + if (wVal.val) { + let num = Number(wVal.val) * Number(jsonList.western[wVal.type]); + num = num / Number(jsonList.indian[iVal.type]); + document.getElementById('i_number').value = num; + } else if (iVal.val) { + let num = Number(iVal.val) * Number(jsonList.indian[iVal.type]); + num = num / Number(jsonList.western[wVal.type]); + document.getElementById('numberVal').value = num; + } else { + document.getElementById('i_number').value = 1; + document.getElementById('numberVal').value = 0; + } + console.log('BM:', wVal); +} +