javascript - Assign an object to a let keyword when outside of scope -


at moment, using var assigned object hook. wanting change let, keep stumbling across errors.

current setup:

var tc;  module.exports = {    before(browser) {     tc = new func()(x, y); // needs assigned here.   },    'test': function (browser) {     tc // needs referenced here too.   },  }; 

how can change let yet assign/reference within other hooks , test cases (i'm using mocha).

use this.parameter

module.exports = {    before(browser) {     this.tc = new func()(x, y); // it's assigned object context.   },    'test': function (browser) {     return this.tc; // can reference variable inside object   },  }; 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -