Skip to content

Instantly share code, notes, and snippets.

View seanlindo's full-sized avatar

Sean Lindo seanlindo

  • @EngageTalent
  • Charleston, SC
View GitHub Profile
@StevenLangbroek
StevenLangbroek / class.js
Last active May 3, 2019 20:05
Private variables in ES6 Classes.
/**
* So, obviously this is by no means a "new trick",
* but encapsulation in classes works the same as
* it does in "Modules" (IIFE pattern): You hide them
* in a scope, and define the methods that need access
* to them within that same scope. The constructor is
* as good a place as any for that.
*/
import _ from 'underscore';
@ewinslow
ewinslow / classes.md
Last active January 24, 2018 04:03
How I wish ES6 classes were implemented

Introduction

ES6 classes are happening, and there's no way the syntax is going to change radically just for me this late in the game, but I still figure what the heck. Maybe I can write a language someday that has this feature. Or maybe I'm wrong and the feature can change with enough motivation...

Background

The main premise of the currently accepted syntax is to be simple sugar over the prototype style of class definitions:

function Foo() {