# I need help to OOJS

**URL:** <https://discourse.mozilla.org/t/i-need-help-to-oojs/80338>\
**Category:** Learn\
**Tags:** issue\
**Created:** [May 17, 2021, 8:06pm UTC](https://discourse.mozilla.org/t/i-need-help-to-oojs/80338 "2021-05-17T20:06:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evgen\_Shkaruba](https://avatars.discourse-cdn.com/v4/letter/e/779978/32.png) [@Evgen\_Shkaruba](https://discourse.mozilla.org/u/Evgen_Shkaruba)\
**Post date:** [May 17, 2021, 8:06pm UTC](https://discourse.mozilla.org/t/i-need-help-to-oojs/80338/1 "2021-05-17T20:06:43Z")

</div>

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

> <https://github.com/Jack-studio/add/blob/main/objkt_oriented.html>

---

<div class="post-metadata">

**Author:** ![Evgen\_Shkaruba](https://avatars.discourse-cdn.com/v4/letter/e/779978/32.png) [@Evgen\_Shkaruba](https://discourse.mozilla.org/u/Evgen_Shkaruba)\
**Post date:** [May 18, 2021, 6:42pm UTC](https://discourse.mozilla.org/t/i-need-help-to-oojs/80338/2 "2021-05-18T18:42:04Z")

</div>

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());
```

---

<div class="post-metadata">

**Author:** ![Gabriel\_Ramos\_Nogueira](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@Gabriel\_Ramos\_Nogueira](https://discourse.mozilla.org/u/Gabriel_Ramos_Nogueira)\
**Post date:** [May 26, 2021, 1:08pm UTC](https://discourse.mozilla.org/t/i-need-help-to-oojs/80338/3 "2021-05-26T13:08:13Z")

</div>

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.
