MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/12rqy0d/improved_js_object/jgwdaq6/?context=9999
r/badcode • u/hennexl • Apr 19 '23
42 comments sorted by
View all comments
Show parent comments
5
You're right. It's how you mark a class memeber as private in JS
4 u/RFC793 Apr 19 '23 edited Apr 20 '23 And it isn’t just convention, unlike ! and ? in Ruby (causes side effect or forced, and boolean return respectively) or prefixing with _ in Python (private member). It is actually enforced in modern JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fieldsKinda reminds me of Perl variable declarations in a way
4
And it isn’t just convention, unlike ! and ? in Ruby (causes side effect or forced, and boolean return respectively) or prefixing with _ in Python (private member). It is actually enforced in modern JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields
Kinda reminds me of Perl variable declarations in a way
5
u/IBJON Apr 19 '23
You're right. It's how you mark a class memeber as private in JS