Assessment wanted for OOJS 1/2/3 skill test

Hello! This is my first time posting assessment here. Please help me assess my work. Thank you! :grinning:

OOJS1

function Shape(name, sides, sideLength) {
this.name = name;
this.sides = sides;
this.sideLength = sideLength;
}
// Write your code below here
Shape.prototype.calcPerimeter = function() {
console.log(this.sides * this.sideLength);
}
const square = new Shape(“square”, 4, 5);
square.calcPerimeter();
const triangle= new Shape(“triangle”, 3, 3);
triangle.calcPerimeter();

OOJS2

class Shape {
constructor(name, sides, sideLength) {
this.name = name;
this.sides = sides;
this.sideLength = sideLength;
}
calcPerimeter() {
console.log(this.sides * this.sideLength);
}
}
const square = new Shape(“square”, 4, 5);
square.calcPerimeter();
const triangle= new Shape(“triangle”, 3, 3);
triangle.calcPerimeter();

OOJS3

class Shape {
constructor(name, sides, sideLength) {
this.name = name;
this.sides = sides;
this.sideLength = sideLength;
}
calcPerimeter() {
console.log(this.sides * this.sideLength);
}
}
class Square extends Shape{
constructor(sideLength) {
super(“square”,4,sideLength);
}
calcArea() {
console.log(this.sideLength * this.sideLength);
}
}
const square = new Square(5);
square.calcPerimeter();
square.calcArea();

Hi @harvey25115 and welcome to the community :wave:

Congratulations! All three tasks are correct :medal_sports:

If you like to post more assessments in the future it would be really helpful for us if you put your code into an online editor and post the link. It is much easier for us to assess your work if we see running code and can test different things out.
Also please make sure to add a link to the task page on MDN.
You will find these instructions at the bottom of all task pages. For example: Assessment or further help | MDN

Thank you and have fun coding :slightly_smiling_face:
Michael

1 Like

Oh I forgot about the task page link. Okay noted! Thanks! :slight_smile: