# Roman Numeral Converter - All test pass in node but fail in fcc platform

Tell us what’s happening:
All the tests pass / produce the desired outcomes.
I’ve console.logged “expected result” and “result” side by side - for all your tests & all match.
How come not all pass on the platform?

``````
function convertToRoman(num) {
let conv1 = {
1: "I", 2: "II", 3: "III", 4: "IV", 5: "V",6: "VI",7: "VII",8: "VIII", 9: "IX"
}
let conv2 = {
1: "X", 2: "XX", 3: "XXX", 4: "XL", 5: "L", 6: "LX", 7: "LXX", 8: "LXXX", 9: "XC"
}
let conv3 = {
1: "C", 2: "CC", 3: "CCC", 4: "CD", 5: "D", 6: "DC", 7: "DCC", 8: "DCCC", 9: "CM"
}
let conv4 = {
1: "M", 2: "MM", 3: "MMM", 4: "MMMM", 5: "V", 6: "VM", 7:"VMM", 8: "VMMM", 9: "VMMMM"
}
let len = String(num).length
let thing = String(num)
if (len === 1){
for (let i in conv1){if (i === thing){return conv1[i]}}
}
if (len === 2){
let res = []
for (let i in conv2){if (i === thing[0]){res.push(conv2[i])}}
for (let i in conv1){if (i === thing[1]){res.push(conv1[i])}}
return res.join("")
}
if (len === 3){
res = []
for (let i in conv3){if (i === thing[0]) {res.push(conv3[i])}}
for (let i in conv2){if (i === thing[1]) {res.push(conv2[i])}}
for (let i in conv1){if (i === thing[2]) {res.push(conv1[i])}}
return res.join("")
}
if (len === 4){
res = []
for (let i in conv4){if (i === thing[0]) {res.push(conv4[i])}}
for (let i in conv3){if (i === thing[1]) {res.push(conv3[i])}}
for (let i in conv2){if (i === thing[2]) {res.push(conv2[i])}}
for (let i in conv1){if (i === thing[3]) {res.push(conv1[i])}}
return res.join("")
}
}

convertToRoman(36);

``````

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36`.

Challenge: Roman Numeral Converter

Welcome, Simon.

You have 2 cases of undeclared variable `res`.

In the fCC editor, the default setting on the compiler is `'use strict'`. So, in some environments the declaration can be ignored. However, this is bad practice. So, declare all of your variables.

I hope this helps

1 Like

if you want to get the same errors in an other environment you can activate the strict mode mentioned by @Sky020 writing `'use strict'` (quotes included) in the first line of your code

1 Like

Many thanks! In the words of Homer Simpson Doh!

Yes that helped. Thanks.