Sobes.tech
Junior — Senior

Converting a constructor function to an ES6 class

livecode

Task condition

Rewrite the given constructor and prototype method using modern JavaScript class syntax.

class Bike {
  constructor(model, color) {
    this.model = model;
    this.color = color;
  }

  getDetails() {
    return this.model + ' bike has ' + this.color + ' color';
  }
}