## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
CamperBot
@camperbot

## :fire:Bonfire: Roman Numeral Converter :link:

function convert(num) {
return num;
}

convert(36);

Convert the given number into a roman numeral.

more info:  bf details | bf links | hint

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [1/6]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [2/6]

## # Problem Explanation:

• You will create a program that converts an integer to a roman numeral.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [3/6]

## Hint: 1

• Creating an array with the Roman Numerals and one with the decimal equivalent for the new forms will be very helpful.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [4/6]

## Hint: 2

• If you add the numbers that go before the new letter is introduced, it will save you plenty of code, like values for 4, 9, and 40.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [5/6]

## Hint: 3

• You can't have more than three consecutive Roman numerals together.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali
@demirovicAli
hint
CamperBot
@camperbot

hint [6/6]

# Code Solution:

var convert = function(num) {

// Create arrays with default conversion with matching indices.
var decimalValue = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ];
var romanNumeral = [ 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I' ];

//empty string variable for the final roman number

var romanized = '';

// Loop through the indices of the decimalValue array.
for (var index = 0; index < decimalValue.length; index++) {
// Continue to loop while the value at the current index will fit into numCopy
while (decimalValue[index] <= num) {
// Add the Roman numeral & decrease numCopy by the decimal equivalent.
romanized += romanNumeral[index];
num -= decimalValue[index];
}
}

return romanized;
};

# Credits:

If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @Rafase282 @SaintPeter @benschac for your help with Bonfire: Roman Numeral Converter

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [1/6]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [2/6]

## # Problem Explanation:

• You will create a program that converts an integer to a roman numeral.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [3/6]

## Hint: 1

• Creating an array with the Roman Numerals and one with the decimal equivalent for the new forms will be very helpful.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [4/6]

## Hint: 2

• If you add the numbers that go before the new letter is introduced, it will save you plenty of code, like values for 4, 9, and 40.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [5/6]

## Hint: 3

• You can't have more than three consecutive Roman numerals together.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot

hint [6/6]

# Code Solution:

var convert = function(num) {

// Create arrays with default conversion with matching indices.
var decimalValue = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ];
var romanNumeral = [ 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I' ];

//empty string variable for the final roman number

var romanized = '';

// Loop through the indices of the decimalValue array.
for (var index = 0; index < decimalValue.length; index++) {
// Continue to loop while the value at the current index will fit into numCopy
while (decimalValue[index] <= num) {
// Add the Roman numeral & decrease numCopy by the decimal equivalent.
romanized += romanNumeral[index];
num -= decimalValue[index];
}
}

return romanized;
};

# Credits:

If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @Rafase282 @SaintPeter @benschac for your help with Bonfire: Roman Numeral Converter

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Makist95
@Makist95
hint
CamperBot
@camperbot
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page
ziming
@ziming
hint
CamperBot
@camperbot

hint [1/6]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

ziming
@ziming
hint
CamperBot
@camperbot

hint [2/6]

## # Problem Explanation:

• You will create a program that converts an integer to a roman numeral.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

ziming
@ziming
hint
CamperBot
@camperbot

hint [3/6]

## Hint: 1

• Creating an array with the Roman Numerals and one with the decimal equivalent for the new forms will be very helpful.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

ziming
@ziming
hint
CamperBot
@camperbot

hint [4/6]

## Hint: 2

• If you add the numbers that go before the new letter is introduced, it will save you plenty of code, like values for 4, 9, and 40.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

ziming
@ziming
hint
CamperBot
@camperbot

hint [5/6]

## Hint: 3

• You can't have more than three consecutive Roman numerals together.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

ziming
@ziming
hint
CamperBot
@camperbot

hint [6/6]

# Code Solution:

var convert = function(num) {

// Create arrays with default conversion with matching indices.
var decimalValue = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ];
var romanNumeral = [ 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I' ];

//empty string variable for the final roman number

var romanized = '';

// Loop through the indices of the decimalValue array.
for (var index = 0; index < decimalValue.length; index++) {
// Continue to loop while the value at the current index will fit into numCopy
while (decimalValue[index] <= num) {
// Add the Roman numeral & decrease numCopy by the decimal equivalent.
romanized += romanNumeral[index];
num -= decimalValue[index];
}
}

return romanized;
};

# Credits:

If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @Rafase282 @SaintPeter @benschac for your help with Bonfire: Roman Numeral Converter

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Abhilash
@abhilash69
Thanks @Rafase282 @SaintPeter @benschac for your help with Bonfire: Roman Numeral Converter
CamperBot
@camperbot
abhilash69 sends brownie points to @rafase282 and @saintpeter and @benschac :sparkles: :thumbsup: :sparkles:
:star: 2238 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 839 | @rafase282 | http://www.freecodecamp.com/rafase282
:star: 317 | @benschac | http://www.freecodecamp.com/benschac
Ragnar Örn Ólafsson
@ragnaro89
help
CamperBot
@camperbot

### Basic Commands:

• find TOPIC find all entries about topic. ex: find js
• wiki TOPIC show contents of topic page
• thanks @username send brownie points to another user
• about @username shows info on that user
• bonfire BONFIRENAME info on a bonfire

:speech_balloon: meet CamperBot in this room!

Ragnar Örn Ólafsson
@ragnaro89
hint
CamperBot
@camperbot

hint [1/6]

## ## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ragnar Örn Ólafsson
@ragnaro89
hint
CamperBot
@camperbot

hint [2/6]

## # Problem Explanation:

• You will create a program that converts an integer to a roman numeral.

type hint for next hint :pencil: [Contribute at the FCC Wiki]