ES6 Lesson #10 - Function expression

Classes in es6 are functions, so we can declare them in several ways. Look in code

// Variant 1
class Task {
	constructor() {
  	console.log("class 1")
  }
}
let task = new Task();

// Variant 2
let Task2 = class {
  constructor() {
    console.log("class 2")
  }
}

let task2 = new Task2();


And subtask example:

let Task2 = class {
  constructor() {
    console.log("class 2")
  }
}

let subClass = class extends Task2 {
  constructor() {
    super();
    console.log("class 3")
  }
}

let task2 = new Task2();
let tasubclass = new subClass();

But few people use this way, since debugging in this method causes problems. In this way u cant use console.dir() for expand object. 😪