Assessment wanted for OOJS 1 skill test. Task-1.
Task-1.
by EiNzp
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>OOJS: Task 1</title>
<link rel="stylesheet" href="styles/style.css">
</head>
<body>
<section class="preview">
</section>
</body>
<script src="scripts/script.js"></script>
</html>
CSS
p {
color: purple;
margin: 0.5em 0;
}
* {
box-sizing: border-box;
}
JavaScript
class Shape {
name;
sides;
sideLength;
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();