this

Задача #1

Что будет в консоли и почему?

const userService = {
    currentFilter: "active",
    users: [
        { name: "Alex", status: "active" },
        { name: "Nick", status: "deleted" },
    ],
    getFilteredUsers: function () {
        return this.users.filter(function (user) {
            return user.status === this.currentFilter;
        });
    },
};
 
console.log(userService.getFilteredUsers());

Задача #2

Что будет в консоли и почему?

this.width = 30;
 
const smallBox = {
    height: 10,
    width: 10,
    displaySize: function () {
        console.log(this.height, this.width);
    },
};
 
const largeBox = {
    height: 20,
    width: 20,
    displaySize: () => console.log(this.height, this.width),
};
 
smallBox.displaySize(); // ???
largeBox.displaySize(); // ???
 
smallBox.displaySize.bind(largeBox)(); // ???
largeBox.displaySize.bind(smallBox)(); // ???