Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Morse Clock by Moff
function morseClock(data) {
const l1 = [2, 3, 3];
let m = (n, l) => {
let result = parseInt(n).toString(2)
.replace(/1/g, '-')
.replace(/0/g, '.');
while (result.length < l)
result = '.' + result;
return result;
};
let res = data.split(':')
.map(n => n.length === 1 ? '0' + n : n)
.map((n, i) => `${m(n[0], l1[i])} ${m(n[1], 4)}`);
return res.join(' : ');
}
July 7, 2017