Skip to main content

static foo

class BadgerAdoptionAgency {
  constructor() {
    this.badgers = [];
  }

  static foo() {
    this.thing = 'bar;'
    this.agencies = [];
  }

  static baz() {
    const a = new BadgerAdoptionAgency();
    this.agencies.push(a);
    console.log(this.thing);
  }

  static getA() {
    console.log(this.agencies);
  }

  addBadger(name, age, size) {
    const badger = {
      name: name,
      age: age,
      size: size
    };

    this.badgers.push(badger);
  }

  listBadgers() {
    console.log(this.badgers);
  }

  showBadger(name) {
    const badger = this.badgers.find((badger) => badger.name === name);
    console.log(badger);
  }

  adoptBadger(name) {
    const badger = this.badgers.find((badger) => badger.name === name);
    this.badgers = this.badgers.filter((badger) => badger.name !== name);
    return badger;
  }
}
class Counter {
  constructor() {
    this.count = 0;
  }

  inc() {
    this.count += 1;
  }

  print() {
    console.log(this.count);
  }
}

const agency = new BadgerAdoptionAgency();
BadgerAdoptionAgency.foo();
BadgerAdoptionAgency.baz();
BadgerAdoptionAgency.getA();