-1

Change value of a variable passing through a class is possible?

Do not work with global variable this.status and also does not work with local variable

I need to change the status right after the execute "appendTo"

the result of both is undefined.

        let status;
        const client = new Myclass();
        client.add(url, result => {
            this.status = false;
            result.files.appendTo('#div');

            status = false
        });

        console.log(status)
        console.log(this.status)
marcelo.delta
  • 2,730
  • 5
  • 36
  • 71

1 Answers1

0
    let status;
    var me=this;
    const client = new Myclass();
    client.add(url, result => {
        me.status = false;
        result.files.appendTo('#div');
    });

    console.log(status)
    console.log(this.status)