Skip to content

Instantly share code, notes, and snippets.

@a-m-dev
Last active November 29, 2018 07:51
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 a-m-dev/cf2e75eed8fa3c7996c62c20f58cb8a1 to your computer and use it in GitHub Desktop.
Save a-m-dev/cf2e75eed8fa3c7996c62c20f58cb8a1 to your computer and use it in GitHub Desktop.
// module one
class TempClass {
justLog() {
// do what ever the heck you want...
console.log('hi there...')
}
}
module.exports = TempClass
------------------------------------------------------------------------------
// module two
const myFreakingTempClass = require('./tmp')
var method = "justLog";
var _instance = new myFreakingTempClass();
_instance[method]()
------------------------------------------------------------------------------
// just for grasping the concept up there...
// precomputed property name concept in nutshell...
const _obj = {
name: 'my name',
"tmp Val": 'wassap',
"pre computed": 'third value'
}
console.log(_obj.name)
console.log(_obj['tmp Val'])
const pre = 'pre'
const compute = 'computed'
const _val = `${pre} ${compute}`
console.log(_obj[_val])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment