Last active
November 29, 2018 07:51
-
-
Save a-m-dev/cf2e75eed8fa3c7996c62c20f58cb8a1 to your computer and use it in GitHub Desktop.
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
// 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