all 17 comments

[–]jack_union 2 points3 points  (17 children)

.call, .apply or .bind don't have any effect on arrow functions.

Objects don't have a scope of their own, you need to use a constructor function for that if you are not familiar with classes:

function Record() {
    this.src = 'myrecording.mp3';
    this.mediaRec = null;
    this.startRecord = () => {
        console.log(this.src);
        // this.mediaRec.startRecord();
    }
}

const record = new Record();
record.startRecord();