Roman numarul converter

how can i get this to open live with visual studio code

function convertToRoman(num) {
  function getNumeral(digit, lowStr, midStr, nextStr) {
    switch (true) {
      case digit <= 3:
        return lowStr.repeat(digit);
      case digit === 4:
        return lowStr + midStr;
      case digit <= 8: // digits 5-8
        return midStr + lowStr.repeat(digit - 5);
      default: // digit 9
        return lowStr + nextStr

  let str = ""

  // Thousands
  str += "M".repeat(Math.floor(num/1000));
  num %= 1000;

  // Hundreds
  str += getNumeral(Math.floor(num/100), 'C', 'D', 'M')
  num %= 100;

  // Tens
  str += getNumeral(Math.floor(num/10), 'X', 'L', 'C')
  num %= 10;

  // Ones
  str += getNumeral(num, 'I', 'V', 'X')

  return str;


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

does that make any differance ?

what do you mean with “open live”?

so people can use it run it basicly

visual studio code is a code editor

if you have nodejs you can run the js file with that from the command line
node <file_name>

so i just type that in?

you can execute js files from the terminal like that, is it what you want to do?

i just want the code to work but i dont know y it isnt :cry:

it just says something about not declaring the type of code

what are you doing?

also if you have an error you should give it verbatim

give it a verbatim ?

give it word for word

im just trying to make a roman numarul converter

how do i do that???

word for word :slightly_smiling_face:

the ideal technique to give an error word for word is to copy it and then paste it where you are asking questions about it

how do i code that
when do u learn it at fcc

copying and pasting is considered a prerequisite, and part of the basics of being able to use a computer, so it is not included in freeCodeCamp