Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Binary-digits/JavaScript/binary-digits-2.js
Normal file
24
Task/Binary-digits/JavaScript/binary-digits-2.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(() => {
|
||||
"use strict";
|
||||
|
||||
// ------------------ BINARY DIGITS ------------------
|
||||
|
||||
// showBinary :: Int -> String
|
||||
const showBinary = n =>
|
||||
showIntAtBase_(2)(n);
|
||||
|
||||
|
||||
// showIntAtBase_ :: // Int -> Int -> String
|
||||
const showIntAtBase_ = base =>
|
||||
n => n.toString(base);
|
||||
|
||||
|
||||
// ---------------------- TEST -----------------------
|
||||
const main = () => [5, 50, 9000]
|
||||
.map(n => `${n} -> ${showBinary(n)}`)
|
||||
.join("\n");
|
||||
|
||||
|
||||
// MAIN ---
|
||||
return main();
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue