Learn Intermediate OOP by Building a Platformer Game - Step 65

This code should be correct but it says it isn’t

  constructor() {
    this.x = x;
    this.y = y;
  }

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 65

Hello @surfera23

The requirement of that step says:

Inside the Platform class, create a constructor that takes in the x and y coordinates.

The word takes probably means that the constructor should accept two arguments. In order to accept them, it has to be defined first within the parenthesis. Mind that it says nothing about using them in the body of the constructor.

3 Likes

I entered this code and a lot of variations of it but it isn’t working

class Platform {
  constructor(x, y) {
  }

this is correct

make sure you don’t have a missing ending curly brace otherwise the test won’t run here

you can try resetting the lesson, and just adding the constructor again.
it passes on my end

that worked. thank you

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.