JavaScript · Middle · Question 10 of 75

How does #count differ from _count in a class?

Explanation

An underscore is a convention; the property is still accessible. Private # fields are enforced by the engine: accessing obj.#count from outside is a syntax error. You can check for presence with #count in obj.

Further reading

Problem with a question

JavaScript · Middle · question 10

Test yourself

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

Take this quiz