Skip to content

Instantly share code, notes, and snippets.

@menicosia
Last active June 4, 2018 16:59
Show Gist options
  • Save menicosia/73087e40bdbdb675d8eed21925df226c to your computer and use it in GitHub Desktop.
Save menicosia/73087e40bdbdb675d8eed21925df226c to your computer and use it in GitHub Desktop.
$ cat classScope.js
"use strict" ;
class classScope {
constructor(item) {
var self = this ;
self._item = item ;
}
lexicalMethod() {
console.log("Here's the item: " + self._item) ;
}
}
var g = new classScope("1") ;
g.lexicalMethod() ;
$ node classScope.js
/Users/pivotal/tmp/t/classScope.js:10
console.log("Here's the item: " + self._item) ;
^
ReferenceError: self is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment