I need help to OOJS

I don’t know what happened?
Because, OOJS1 - finished and I tryed to OOJS2 and now I can’t doing OOJS1 !
Please, help me:

OOJS: Task 1 p { color: purple; margin: 0.5em 0; }
    * {
        box-sizing: border-box;
    }
</style>
<!--<link rel="stylesheet" href="../styles.css" />-->
<section class="preview">
    <input type="text" class="name">
    <input type="text" class="sides">
    <input type="text" class="sideLenght">
    <button>Go</button>
    <input type="text" class="finish">
</section>

or

Figured out:
function Shape(name, sides, sideLength) {
this.name = name;
this.sides = sides;
this.sideLength = sideLength;

    this.calcPerimeter = function() {
        if (this.name === 'round' && this.sides === '') {
            return Math.PI * Math.pow(0.5 * this.sideLength, 2);
        } else {
            return this.sides * this.sideLength;
        }
    }
};

let square = new Shape('square', 4, 5);
console.log(square.calcPerimeter());

let round = new Shape('round', '', 5);
console.log(round.calcPerimeter());
2 Likes

Congratulations, apparently you have solved the problem. One observation is that this method can and should be declared in the prototype of its manufacturer. Challenge yourself to do this.