Answers for "use this inside a foreach"

1

use this inside a foreach

arr.forEach(function(obj) {
        this.addObject(new Obj(obj.prop1, obj.prop2));
    }.bind(this));
Posted by: Guest on May-24-2021
1

use this inside a foreach

arr.forEach(function(obj) {
        this.addObject(new Obj(obj.prop1, obj.prop2));
    }.bind(this));
Posted by: Guest on May-24-2021

Browse Popular Code Answers by Language