#Classes in ES6: Undefined x and y

10 messages · Page 1 of 1 (latest)

safe pike
#
let bubble;

function setup() {
  createCanvas(600, 400);
  bubble = new Bubble();
  print(bubble.x, bubble.y);
}

function draw() {
  background(0);
}

class Bubble {
  contructor(x, y) {
    this.x = 200;
    this.y = 150;
  }
  
}```

I've been following along with the Code! lessons and I'm having issues with the lesson "Classes in ES6". When running this, copying shiffman's example line for line, the result is "undefined undefined" for the print of x and y. What seems to be the cause and what would be the remedy?
tropic tartan
#

if you passed in no arguments, js will treat it as new Bubble(undefined, undefined)

#

oh wait, nvm, sorry
misread your code

safe pike
#

If anything, this is shiffman's code, just copied

safe pike
tropic tartan
safe pike
#

okg

#

omg

safe pike
#

ty lol