Comment

Comment by nodesocket

I was just talking to my friend who works at NetFlix on the frontend team about ES6, he is most excited about destructuring `let { name, age, gender } = user;`. I however advocate that the new class syntax is the best part of ES6. Take the following trivial OOP example, which I think reads so much easier a lot like PHP.

    "use strict";

    class Vehicle {
        constructor(name) {
            this.kind = 'Vehicle';
            this.name = name;
        }

        printName() {
            console.log(this.name);
        }
    }

    class Car extends Vehicle {
        constructor(name) {
            super(name); //call the parent method with super
            this.kind = 'Car';
        }
    }

    let myCar = new Vehicle('Mercedes');
    console.log(myCar);
parent nodesocket 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton