Skip to content

Instantly share code, notes, and snippets.

View ypopovych's full-sized avatar
👨‍💻
building Datadog CI Visibility Swift SDK

Yehor Popovych ypopovych

👨‍💻
building Datadog CI Visibility Swift SDK
View GitHub Profile
@ypopovych
ypopovych / roman-number.js
Created February 10, 2018 11:35
Several ways to do Rome numbers converter
const romanNumerals = [
[1000, "M"], [500, "D"], [100, "C"],
[50, "L"], [10, "X"], [5, "V"], [1, "I"]
];
const toRomeRecursion = (function convert(index, number) {
if (number === 0) return '';
let [romanNumber, romanLiteral] = romanNumerals[index];
if (number < romanNumber) return convert(index+1, number);