ES6 - Use class Syntax to Define a Constructor Function

I think the questions might need some clarification as well.

  1. Yes, I’d say you are responsible for returning the object in that case.

  2. Yes and no. A constructor function can be called without new but then it doesn’t work the same way. There are for example built-in JS constructor functions you can call with or without new. They do not return the same thing.

typeof new Date()
'object'

typeof Date()
'string'
  1. A class is considered syntactic sugar. But I’m not sure what it is you are comparing it against exactly. For one, you can’t call it without new so as per #2 they are not the same. Hoisting also doesn’t work the same.
const person = new Person('John'); // Cannot access 'Person' before initialization

class Person {
  constructor(name) {
      this.name = name;
  }
  sayHello() {
      return `Hello, I'm ${this.name}`;
  }
}

const person = Person('John'); // Class constructor Person cannot be invoked without 'new'

Anyway, I would agree that the questions do call for research in any case.