JavaScript ECMA Class Example


SUBMITTED BY: YouKnowNothing

DATE: Jan. 3, 2016, 5:18 a.m.

FORMAT: JavaScript

SIZE: 254 Bytes

HITS: 10483

  1. class food {
  2. constructor(){
  3. this.eatable = true;
  4. }
  5. }
  6. //The bacon class extends the food object
  7. class bacon extends food{
  8. constructor(cancerous){
  9. this.cancerous = cancerous || false;
  10. super();
  11. }
  12. }
  13. var baconStrip = new bacon(true);

comments powered by Disqus