Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So in the last video we learned about classes and we learned about properties and methods.
There too. Now next generation javascript also offers a different syntax of initializing properties and methods.
And actually it is this more modern syntax I'll use in this course.
So I want to show it to you here too.
You already learned that properties are like variables you attach to classes and objects, methods are
like functions attached to classes and objects and you'll learn about this syntax where we set up properties
in the constructor function.
Now there is a more modern syntax which spares us using this constructor function with next generation
javascript as we will use it in this course.
You can assign a property directly inside your class with myProperty equals value.
So you skip the constructor function call.
Behind the scenes this will still be transformed to use constructor functions.
But you'll have an easier time writing this and for methods, it's pretty similar.
This is the old way.
I showed you in the last lecture.
Now the next generation javascript way is to use the syntax from the left where you set up a property
and simply think of a method as a property which stores a function as a value and then you end up with
that.
My method equals and then an arrow function.
The great advantage of this syntax is that since you use an arrow function as a property value here you've
got no problems with the this keyword and that's the exact reason why we will use this syntax here on the
bottom right corner and the syntax on the bottom left corner throughout this course.
Let me show you the syntaxes to you.
Back to jsbin on the project we already worked on here with the human and the person class.
We can get rid of the constructor in the human class and get rid of the this keyword.
and just set gender equal to male and print.
Gender can be set equal to an arrow function where we console log.
this.gender still using the this keyword in here when we reach out to the property.
Though you may ignore that arrow for now the same for the person we no longer need the constructor
and we no longer need to call super for that reason.
Instead what we do is we call this name without this just name equal to Max and gender equal female
if you want to and printMyName equals an arrow function too, like this.
Now if you clear this and run this you will get an error because it doesn't recognize the syntax
you actually need to go to the dropdown where it says javascript and choose ES6.
Babel here.
If you do this and hit clear and run you'll see Max and female.
You'll still see the arrows on the left but you may ignore them.
This is the syntax which is next generation javascript which we will actually use in this course.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.