Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@a1exlism
Created September 24, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a1exlism/b17473a8c3091bc399d58603343ec4bc to your computer and use it in GitHub Desktop.
Save a1exlism/b17473a8c3091bc399d58603343ec4bc to your computer and use it in GitHub Desktop.
class Test {
constructor() {
this.data = {
name: null,
age: -1,
attr: null
}
}
init() {
this.data = {
name: 'Alice',
age: 5,
attr: this.data.name + ' is ' + this.data.age + ' year old.'
}
}
}
a.init()
// undefined
a.data.attr
// "null is -1 year old."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment