ES6 - Use class Syntax to Define a Constructor Function

Tell us what’s happening:
Describe your issue in detail here.
This lesson seems take a lot of leap… I am following the JAVA curriculum from beginning but this lesson seems mentioned many things that I haven’t come across before. such as " class" " constructor" and try to tell the difference in ES5 and ES6 when I don’t even know what constructor and class’s formulate in ES5

I am now try to understand the concept by watching youtube video… hopefully I will found a video to make me understand. I am not sure if any new Java learner has the same feeling of this class is taking too much leap - or is it just me.

Your code so far

// Only change code below this line

// Only change code above this line

const carrot = new Vegetable('carrot');
console.log(carrot.name); // Should display 'carrot'

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15

Challenge: ES6 - Use class Syntax to Define a Constructor Function

Link to the challenge:

You mean JavaScript. Java is completely unrelated to JavaScript.

You don’t need any ES5 syntax for this Challenge. I’d look only at the example given.

1 Like

You don’t need any ES5 syntax for this Challenge

The question is why it is included in this lesson in the first place, then.

Just as the ‘constructor’, ‘new’ and ‘this’ keywords a person doing this course has no idea about.

It’s given as a comparison. Originally this module was written for people who know ES5 and needed to learn ES6

Comparison to what exactly? I can say it again, the ‘constructor’, ‘new’ and ‘this’ keywords are being encountered for the very first time in these curriculums.

Try to go through from this link- ES6 - Classes it will help!

A comparison to the ES5 stuff that the learners already knew… Since this module was written for people who know ES5

Since ES6 features are no longer new and are now standard, this section got moved forward in the curriculum and treated as less of a refresher module. But some of the older language still remains.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.