Today, I completed coding my Roman numeral converter. My next endeavor is to develop a telephone number validator. I’ve already begun laying the groundwork for this project by setting up the HTML and JavaScript. While I could use some assistance with the remaining code, I’ll be able to figure it out.
Today in therapy, I discussed my dad’s passing and the emotions surrounding it. This Friday marks the anniversary of his passing. I also reflected on how my relationship with my mom was somewhat smoother when my dad was alive, as he often acted as the mediator. I shared with my therapist the story of how I nearly missed my dad’s burial because my mom provided me with the wrong time. Fortunately, I arrived early and didn’t miss the service entirely. While it’s possible that my mom provided the wrong time due to her distress, this isn’t the first time she has done something like this, leading me to believe it was intentional.
I have an appointment with my ophthalmologist tomorrow. I need to get a new prescription for eyeglasses since my current one is outdated, and my glasses also have some scratches. The ophthalmologist always dilates my eyes for a closer look, so I always leave the center with my eyes dilated.
I need to take Lexi to the storage unit soon so she can retrieve her social security card. I plan to keep the card safe with me after we use the card. She needs the card to renew her state ID. I was printing out her bank statements yesterday for the required address to prove she lives here. Additionally, I’m considering scheduling a doctor’s appointment for the girls, as it has been a while since their last check-up. I should also arrange for Karissa to see a therapist, as it would be beneficial for her.
JavaScript notes…
——————————-
FreeCodeCamp Roman Numeral Converter
** start of html **Document ** end of html ** ** start of javascript ** const input = document.getElementById("number"); const convert = document.getElementById("convert-btn"); const output = document.getElementById("output"); const numerals = [ ["M", 1000], ["CM", 900], ["D", 500], ["CD", 400], ["C", 100], ["XC", 90], ["L", 50], ["XL", 40], ["X", 10], ["IX", 9], ["V", 5], ["IV", 4], ["I", 1], ]; input.addEventListener("keydown", e => { if (e.key === "Enter") { convert.click(); } }) convert.addEventListener("click", () => { let value = input.value; if (!value) { output.innerText = "Please enter a valid number"; } else if (value < 0) { output.innerText = "Please enter a number greater than or equal to 1"; } else if (value > 3999) { output.innerText = "Please enter a number less than or equal to 3999"; } else { let result = ""; for (const [roman, number] of numerals) { while (value >= number) { result += roman; value -= number; } } output.innerText = result; } }) ** end of javascript **