I'm trying to factorize a method, will be passing in certain keywords into it, example keywordA
, keywordB
, and I want to perform certain actions with these keywords using jquery and Tether javascript library.
let wrapperTetherName = `${containerName}WrapperTether`;
This is ok and returns the right name example keywordAWrapperTether, keywordBWrapperTether
How do I do something like (obviously incorrect syntax) :
if (!this.`${wrapperTetherName}`) // this.wrapperTetherName returns undefined
Or any ideas for alternatives? I just want to check the existence of this.keywordAWrapperTetherName
, if it doesn't exist then create a new instance of Tether for it, otherwise, destroy it.