Added solution (#27077)
This commit is contained in:
@ -69,6 +69,19 @@ console.log(carrot.name); // => should be 'carrot'
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
function makeClass() {
|
||||
"use strict";
|
||||
/* Alter code below this line */
|
||||
class Vegetable {
|
||||
constructor(name){
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
/* Alter code above this line */
|
||||
return Vegetable;
|
||||
}
|
||||
const Vegetable = makeClass();
|
||||
const carrot = new Vegetable('carrot');
|
||||
console.log(carrot.name); // => should be 'carrot'
|
||||
```
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user