Encapsulation

2021-9-6 Less than 1 minute

# Encapsulation

# What is the purpose of Encapsulation?

Encapsulating helps protect data and restricts access from the outside, allowing only modules that have access to it to make modifications. Users can not make modifications to the data.

# What were some of the problems with closures and the underscore prefix?

The underscore prefix relies on convention. I must have missed it but I did not see any issue with using closures as using closures support true data privacy.

# How do we create private variables in a ES6 Class? Why would you do this?

Using a hashtag before the variable name. You would do this to prevent data manipulation.

# Daily Challenge

Vendr (opens new window)

Last update: September 12, 2021 19:59
Contributors: Derek Shain