TypeScript Deep Dive - Classes | JSer - Front-End Interview questions

preview_player
Показать описание

Besides the JavaScript spec, TypeScript has public/private/protected, which works as the name says.

Just remember that Class is both a Value and Interface, when used as Interface, it means prototype, the shape of all instance. when used as a normal function (a value), we need to use `typeof Class`.

Hi I'm a JavaScript engineer who is not good at algorithms,
and currently practicing leetCode & BFE.dev. If you are interested, maybe we can learn together.
Рекомендации по теме
Комментарии
Автор

Another patter I've seen while browsing the web is :
`class Person {
constructor(private name: string) {}
}`
which is the same with:
`class Person {
private name;
constructor(theName: string) {
name = theName;
}
}`

faruzzy