When you clone a notebook you are able to make changes without affecting the original notebook.

Classes are a shorthand that make it easier to work with JavaScript's existin prototypal inheritance.

class Shape
{
constructor(sides)
{
this._sides = sides;
}
get sides()
{
return this._sides;
}
}

class Triangle extends Shape
{
constructor(...angles)
{
super(3)
this._angles = angles;
if (angles.length !== 3 || angles[0] + angles[1] + angles[2] !== 180)
throw RangeError("Triangles must have 3 sides at angles equaling 180");
}
get angles()
{
return this._angles;
}
}

(new Triangle(90,45,45)).sides

sign in to comment