# Programming Concepts Used

- ES6
- Regular Expressions
- Data Structures
- Algorithm Scripting
- Debugging
- Functional Programming

# Technologies Used

- JavaScript

# How It Works

Roman numerals are a numeral system that comes from ancient Rome. Numbers in this system are represented by combinations of letters from the Latin alphabet.

I created a function that takes a given number and returns a roman numeral. I defined a variable** ***lookup* that contains an object with key/value pairs of the Roman numerals and their decimal equivalents.

I defined numbers represented by different letters in Roman numerals (*I, V, X, L*,…), and numbers that take place before a new letter is introduced (*IV, IX, XL*,…).

An empty string variable, *romanized,* will hold a final roman number. The for loop loops through the key/value pairs in the lookup object. If the while condition is met, the current* i *key is added to the variable *romanized*, and the *num* number is decreased by the current* i* value. The final roman number is returned as the result of the function.

Example: Let’s turn the number 654 into a Roman numeral.

1. I loop through the variable lookup to meet the while condition at i equals D:500 (let roman=D, let num=654–500=154).

2. loop: the while condition met at i equals C:100 (let roman=DC, let num=154–100=54).

3. loop: the condition met at i L:50 (let roman=DCL, let num=54–50=4).

4. loop: the condition met at i IV:4 (** let roman=DCLIV**, let num=4–4=0).

I used the read-search-ask method whenever I got stuck. I found these pages most helpful:

I‘ll ’keep you updated about my progress!