# What is the error?

**URL:** <https://forum.freecodecamp.org/t/what-is-the-error/377939>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [April 23, 2020, 8:35pm UTC](https://forum.freecodecamp.org/t/what-is-the-error/377939 "2020-04-23T20:35:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akanksha.garg2k](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/akanksha.garg2k/32/144520_2.png) [@akanksha.garg2k](https://forum.freecodecamp.org/u/akanksha.garg2k)\
**Post date:** [April 23, 2020, 8:35pm UTC](https://forum.freecodecamp.org/t/what-is-the-error/377939/1 "2020-04-23T20:35:05Z")

</div>

**Tell us what’s happening:**

**Your code so far**

```js

function convertToRoman(num) 
{
let n=[1,4,5,9,10,40,50,90,100,400,500,900,1000];
let r=["I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"];
let i=12;//size of n array
let ans="";
while(num>0)
{
  let a=Math.floor(num/n[i]);
  num=num%n[i];
  while(a>0)
  {
    ans.concat(r[i]);
    a--;
  }
  i--;
}
return ans;

}
convertToRoman(36);

```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36`.

**Challenge:** Roman Numeral Converter

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![snigo](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/snigo/32/128765_2.png) [@snigo](https://forum.freecodecamp.org/u/snigo)\
**Post date:** [April 23, 2020, 8:39pm UTC](https://forum.freecodecamp.org/t/what-is-the-error/377939/2 "2020-04-23T20:39:01Z")

</div>

> [@akanksha.garg2k](#):
>
> ans.concat(r[i]);

Strings are immutable and no string methods act in place, but return new instance of the string. Fix this line and you’re good to go!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 12:56pm UTC](https://forum.freecodecamp.org/t/what-is-the-error/377939/3 "2021-06-01T12:56:58Z")

</div>

Closed on June 1, 2021, 12:56pm UTC


