vanillajs-deck/slides/160-classes.html

16 lines
335 B
HTML
Raw Permalink Normal View History

2020-01-28 21:41:29 +00:00
<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>