skip navigation

OOPs! No not that kind.

We've got objects whooo! Time to get all the content.

Objects

Objects contain different properties and can also contain methods. Declaring them as a const variable means you can't completely reassign it as a veriable, but you can adjust its properties and methods


const floppyDisk = {
  type: 'Object of Power',
  designation: 'OOP5-KE',
  location: '[REDACTED]',
  launchAbility {
    launch items a lot
  }
}

Classes

Building off objects, classes contain layout info to build new objects.

Class names must begin with a capital

const PrnlItem = class {
  constructor(type, designation, location) {
    this.type = type;
    this.designation = designation;
    this.location = location;
  }
  getAbility (){
    person gets (ability);
  }
};
  const floppyDisk = new PrnlItem 
  ('object of power', '00P5-KE', 'REDACTED]');