mirror of
https://github.com/JeremyLikness/vanillajs-deck
synced 2024-11-15 01:54:57 +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>
|