在方法之间传递局部变量(Node js,prototype)

时间:2015-03-23 06:59:42

标签: javascript jquery node.js prototype

我有两种方法

var variable_to_be_passed; // setting this does not seem to work

A.prototype.beforeEach = function(callback) {
  variable_to_be_passed = 5;
  ParentA.prototype.beforeEach.call(this, test, function() {
  callback();
});

A.prototype.afterEach = function(variable_to_be_passed, callback) {
  console.log(variable_to_be_passed) //prints undefined
  ParentA.prototype.afterEach.call(this, test, function() {
  callback();
});

我想访问A.prototype.aftereach中的variable_to_be_passed。有人可以建议如何做到这一点吗?

由于

0 个答案:

没有答案