Last active
March 28, 2018 14:12
-
-
Save Offirmo/00174e72f4e02751ef06495f40ca1d7a to your computer and use it in GitHub Desktop.
[rare ES6 stuff I forget all the time] #JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports | |
import { Random, Engine } from '@offirmo/random' | |
import { | |
State as MetaState, | |
factory as meta_state_factory, | |
} from '@oh-my-rpg/state-meta' | |
// http://www.benmvp.com/learning-es6-enhanced-object-literals/ | |
return { | |
// computed values | |
['make' + make]: true, | |
// Method definition shorthand syntax | |
depreciate() { | |
this.value -= 2500; | |
} | |
}; | |
// Advanced destructuring | |
// http://wesbos.com/destructuring-default-values/ | |
const person = { first: 'Wes', last: 'Bos' }; | |
const { first: firstName = 'Super Rad' } = person; | |
console.log(firstName); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment