Please, take a look at my solution for the Roman Numerals Converter. What do you think?

I’m curious to know what do you guys think about my solution and thought process: https://repl.it/CeLU/3

Edit: Out of boredom I decided to code a web interface for this little program: http://codepen.io/fellipedepaula/full/kXEvEB/ - enjoy :slight_smile:

Thank you

Well done! That’s very close to my first solution, as well.

Nice! Seeing this, I think I should redo my solution…

...over here
function convertToRoman(num) {
  var roman = [];
  var chars = [
    {'ten':'X', 'five':'V', 'one':'I'},
    {'ten':'C', 'five':'L', 'one':'X'},
    {'ten':'M', 'five':'D', 'one':'C'},
    {'ten':'', 'five':'', 'one':'M'}    
  ];
  
  var counter = 0;
  var n = num;
  while (n > 0) {
    var x = n % 10;
    if (x === 0) {
      counter++;
      n = Math.floor(n / 10);
      continue;
    }
    var toPut;
    switch(x) {
      case 1: toPut = chars[counter].one; break;
      case 2: toPut = chars[counter].one + chars[counter].one; break;
      case 3: toPut = chars[counter].one + chars[counter].one + chars[counter].one; break;
      case 4: toPut = chars[counter].one + chars[counter].five; break;
      case 5: toPut = chars[counter].five; break;
      case 6: toPut = chars[counter].five + chars[counter].one; break;
      case 7: toPut = chars[counter].five + chars[counter].one + chars[counter].one; break;
      case 8: toPut = chars[counter].five + chars[counter].one + chars[counter].one + chars[counter].one; break;
      case 9: toPut = chars[counter].one + chars[counter].ten; break;
    }
    
    roman.unshift(toPut);
    counter++;
    n = Math.floor(n / 10);
  }
  
  return roman.join('');
}