An ES6 class method can be made private by prefixing its name with __________.

  • private
  • this
  • protected
  • underscore
In ES6, a class method can be made private by prefixing its name with an underscore. This convention signals to other developers that the method is intended for internal use and should not be accessed directly from outside the class. While not providing true privacy, it serves as a convention for indicating the method's intended visibility.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *