Assign object function return value to object property

**** throw error: this.getUnit is not a function****

    function ConvertHandler(initialString) {

    this.inputUnit = this.getUnit(initialString);
    this.inputNum = this.getNum(initialString);
    this.returnedUnit = this.getReturnUnit(this.inputUnit);
    this.returnedNum = this.convert();

    this.getNum = function (input) {

        return input.match(/((\d*\.?\d+)*(\/?)(\d*\.?\d+))/igm);
    };

    this.getUnit = function (input) {
        //let result;
        //input req.query.input
        return input.match(/[A-Za-z]+$/i);
    };
     **........**


}
var a = new ConvertHandler('4mi');
console.log(a.spellOutUnit());

** I can’t assign object function return value to object property, can anyone help? **

solved in StackOverflow, thank you,

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.