File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 */
1010
1111
12+ function getRandomDecimalNumber ( ) {
13+ return Math . floor ( Math . random ( ) * 255 ) ;
14+ }
15+
16+
17+ function convertDecimalToBinary ( decimalNumber ) {
18+ return decimalNumber . toString ( 2 ) . padStart ( 8 , "0" ) ;
19+ }
20+
21+
22+ function convertBinaryToDecimal ( binaryString ) {
23+ return parseInt ( binaryString , 2 ) ;
24+ }
25+
26+
27+ function convertDecimalToHexadecimal ( decimalNumber ) {
28+ return decimalNumber . toString ( 16 ) . toUpperCase ( ) ;
29+ }
30+
31+
32+ function convertHexadecimalToDecimal ( hexadecimalString ) {
33+ return parseInt ( hexadecimalString , 16 ) ;
34+ }
35+
1236
1337function App ( ) {
1438 console . clear ( ) ;
@@ -65,16 +89,6 @@ function App() {
6589 convertTo = event . target . value ;
6690 console . info ( `User updated 'convertTo': '${ convertTo } '` ) ;
6791 } ) ;
68-
69- function getDecimalValue ( ) {
70- return Math . floor ( Math . random ( ) * 255 ) ;
71- }
72-
73- function decimalToBinary ( decimalNumber ) { } // TODO
74- function decimalToHexadecimal ( decimalNumber ) { } // TODO
75- function binaryToDecimal ( binaryString ) { } // TODO
76- function hexadecimalToDecimal ( hexadecimalString ) { } // TODO
77-
7892}
7993
8094// Start the app when the DOM is ready.
You can’t perform that action at this time.
0 commit comments