Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/15/2021 in all areas

  1. I think it should work if you use strings instead. Selecting methods dynamically is going to be pretty confusing to anybody who has to maintain your code. I think it's a practice which should be avoided. ... ... constructor(){ this.config = { "branch": "branchA" }; this.classVar = {"a":1} } main(){ this.classVar["b"] = 2; this.branchB(); this[this.config.branch](); } ... ... var myClass = new MyClass(); myClass.main(); myClass.config.branch = "branchB"; myClass.main();
    1 point
×
×
  • Create New...