vanillajs-deck/slides/160-classes.html
2020-01-28 13:41:29 -08:00

16 lines
335 B
HTML

<title>Classes</title>
<h1>Classes</h1>
<pre>
class shape {
constructor(sides) {
this._sides = sides;
}
get sides() { return this._sides; }
static makeShape(sides) {
return new shape(sides);
}
}
const triangle = shape.makeShape(3);
// triangle.sides = 3
</pre>
<next-slide>165-classes-2</next-slide>