From 1a6e1e57cc49fbc46296dd6f82e2e3739b18e726 Mon Sep 17 00:00:00 2001 From: Alan Price <23743415+alanpaulprice@users.noreply.github.com> Date: Thu, 24 Jan 2019 20:36:57 +0000 Subject: [PATCH] Added solution (#27077) --- ...ax-to-define-a-constructor-function.english.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md index 8d53305683..38630922dc 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md @@ -69,6 +69,19 @@ console.log(carrot.name); // => should be 'carrot'
```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' ```