Nested Function – this.function in javascript still occur the “is not a function” error

I want to write the two function inside RomanNumerals function

RomanNumerals.toRoman()
RomanNumberals.fromRoman()

which will return the Roman Number or decode the Roman Numerals. The code is the following as below

function RomanNumerals(x){
this.toRoman = function(x){
        var  roman = {M:1000,CM:900, D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1 }
  
  var ans = '';
  while(number>0){
      for(a in roman){ 
          console.log(a,ans)
          if(roman[a]<=number)
          { ans += a; 
            number-=roman[a]; 
            console.log(a,ans,number)
            break;}
              
      }
  }
  return ans;
  }
  
this.fromRoman = function(x){
        let sum = 0, a;
        const romanNo = { I : 1, V : 5, X : 10, L : 50, C: 100, D : 500, M : 1000}
        const numbers = roman.split('')
        for(let i = 0; i < numbers.length; i++ ){
            if (romanNo[numbers[i]] < romanNo[numbers[i+1]])
            {
                sum += romanNo[numbers[i+1]] - romanNo[numbers[i]]
                i++;
            }
            else 
            {
                 sum+=romanNo[numbers[i]]
            }
        }
        return sum

    }

}

but it is still occouring the following error

TypeError: RomanNumerals.toRoman is not a function

I have looked up a few references similar to this post and followed the following link
JavaScript Nested function
the code syntax mentioned at the below

function Fizz(qux)
{
  this.buzz = function(){
    console.log( qux );
  };
}

still occur the following error as well

TypeError: Fizz.buzz is not a function

What am I missing here to solve this issue?