Javascript – ES6

  javascript

Definiowanie i rozszerzanie klas. Żeby skorzystać z wcześniejszego constructora należy użyć super

//ES6
    class Book {
        constructor(title, author, year) {
            this.title = title;
            this.author = author;
            this.year = year;
        }

        getSummary() {
            return 'whatever';
        }
    }


    //Magazine Subclass
    class Magazine extends Book {
        constructor(title, author, year, month) {
            super(title, author, year);
            this.month = month
        }
    }

new Set()

to taka tablica, która nie przyjmuje duplikatów. Metody add, delete, has. Super sprawa