TypeScript · Junior · Question 41 of 75

How does private in TypeScript differ from #field in JavaScript?

Explanation

After compilation, a private field is an ordinary property that can be read via obj['field']. #field private fields are supported by the JS engine and can't be accessed from outside the class at all. The public, protected and private modifiers are TypeScript tools.

Further reading

Problem with a question

TypeScript · Junior · question 41

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz