FreeCodeCamp Roman Numeral Converter Project Tutorial & Walkthrough

Поделиться
HTML-код
  • Опубликовано: 9 июл 2024
  • This is a tutorial of how to create the Roman Numeral Converter Project for the FreeCodeCamp JavaScript Algorithms and Data Structures Certification. It will be done using HTML and JavaScript but we will be mostly focused on the JavaScript. Hopefully this tutorial was helpful despite me not being the best at explaining things
    Github Repo: github.com/DSeanHD/FreeCodeCa...
    FreeCodeCamp Palindrome Checker Project: www.freecodecamp.org/learn/ja...
    Github: github.com/DSeanHD
    0:00 Intro
    0:13 Project Preview
    0:58 The Tutorial
    #freecodecamp #javascript #javascripttutorial
  • НаукаНаука

Комментарии • 14

  • @ikooong9637
    @ikooong9637 2 месяца назад +1

    Thank you

    • @dseanhd
      @dseanhd  2 месяца назад

      You’re welcome 🙏

  • @labombarde1
    @labombarde1 26 дней назад

    How does the romanSymbols[i]; in your while loop know which symbol to kick out; if the 4loop is on the romanValues.legnth? are they both being 4 looped at the same time, because they are in the same local function? Brilliant work... my pea brain hurts... Thank You for the video!

    • @dseanhd
      @dseanhd  26 дней назад +1

      The while loop detects if the user’s input is more than the index of romanValues it is on. If it is then it will subtract that value from the user input (number.value) and append the corresponding roman numeral until it is no longer greater than that specific value of romanValues. Then, the for loop will continue to iterate and move onto the next value and the while loop continues. Hopefully that makes you understand better

    • @labombarde1
      @labombarde1 26 дней назад

      @@dseanhd I understood all that.. what I don't understand is how 2 different arrays are being affected by a 4loop applied to 1 array.. the romanValues... how does romanSymbols even know he's in the game if the iteration is on the values arr ... my poor pea brain, lol Thank You for trying to explain it to me!

    • @dseanhd
      @dseanhd  26 дней назад +1

      @@labombarde1 the i < romanValues.length part of the for loop is used to ensure that as long as that condition is met, the for loop can still run. It won’t affect the array at all

    • @labombarde1
      @labombarde1 26 дней назад

      @@dseanhd I understand that... I just dont know how romanSymbols knows whats happening.

    • @dseanhd
      @dseanhd  26 дней назад +1

      @@labombarde1 basically, if the value you inserted is greater than the index of romanValues, then, the current index of romanSymbols (which is the same index as romanValues) will append to the string romanNumeral.
      So if for instance, if I inserted 75, the while loop will loop through romanValues until it finds a value greater than 75, which in this case is 50 which is on index 6. 50 corresponds with the symbol L, which is also on index 6 of the romanSymbols array. So, it appends L to romanNumeral and then subtract 50 from 75 which leaves number.value to be 25.
      The while loop will then realise that, 25 isn’t greater than 50 anymore so it stops, allowing the for loop to continue and move onto the the next element that is greater than 25 which would be 10. And then with 10 it repeats the process