Skip to content

Instantly share code, notes, and snippets.

@2012mjm
Created July 26, 2019 12:50
Show Gist options
  • Select an option

  • Save 2012mjm/11c6161eec08b16a89a23682b70167b5 to your computer and use it in GitHub Desktop.

Select an option

Save 2012mjm/11c6161eec08b16a89a23682b70167b5 to your computer and use it in GitHub Desktop.
class Chameleon {
static colorChange(newColor) {
this.newColor = newColor;
return this.newColor;
}
constructor({ newColor = "green" } = {}) {
this.newColor = newColor;
}
}
const freddie = new Chameleon({ newColor: "purple" });
console.log(freddie.colorChange("orange"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment