Shortly after digging in to ES6 Classes for Episode 97, I decided to try them out in a Backbone.js project. As expected, things didn't go as smoothly as I wanted. And while I did generally find a way to make it work (though, not as clean as I was hoping), I ran in to an issue that I wasn't expecting.
ES6 classes don't support data attributes in the class definition.
So – what to do? How do you get data attributes in ES6 classes?
It turns out there are several ways of doing this, some of which harken back to the standard ES5 days. But with ES6 symbols, things get better! It is possible to not only create data attributes on your classes, but also have them be private variables to the individual class instance!
Sit back, get ready for some questions about the validity of ES6 classes and see what it takes to add data attributes to your ES6 classes.