I have a class named Terminal in which I have a function constructor in which i have an anonymous function in which I would like to get access to the output() function in Terminal class. How can I do this?
Using this.output() throws an error. (this.output is not a function)
class Terminal
{
    constructor(contentID, inputID, options)
    {
        if (!contentID || !inputID || !options)
        {
            return false;
        }
        this.cid = contentID;
        this.iid = inputID;
        if (!options['pcName'] || !options['username'])
        {
            return false;
        }
        this.pcname = (options['pcName'].replace('<', '<')).replace('>', '&rt;');
        this.username = options['username'];
        this.version = '0.01';
        // commands
        this.commandsList = [];
        this.commandsList['whoami'] = function(){ Terminal.output('lol') };
        console.log('terminal.js version ' + this.version + ' initializing');
        this.output('ja', true);
        this.output('whoami', true);
        this.output('i dont know bro', false, 'whoami');
    }
    output (text, prefix, cmdName) // cmdName is matters only when prefix is false
    {
        if (this.cid && text)
        {
            if (prefix == true)
            {
                text = this.username + '@' + this.pcname + ':~$ ' + text;
            }
            else if (cmdName)
            {
                text = cmdName + ': ' + text;
            }
            var con = document.getElementById(this.cid);
            con.innerHTML = con.innerHTML + text + '<br>';
        }
    }
    makeCommand (cmd)
    {
        if (cmd && cmd != '' && this.commandsList)
        {
            cmd = (cmd.replace('<', '<')).replace('>', '&rt;');
            if (this.commandsList[cmd])
            {
                console.log('Executing ' + cmd);
                this.commandsList[cmd]();
            }
        }
    }
}
 
     
    