mirror of
https://github.com/JeremyLikness/vanillajs-deck
synced 2024-12-04 19:27:37 +00:00
16 lines
335 B
HTML
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> |