Skip to content

Instantly share code, notes, and snippets.

@ben-ng ben-ng/a-repro.js
Created Mar 24, 2017

Embed
What would you like to do?
Salesforce Marketing Cloud constructor-from-closure bug
function newEnv () {
function Foo () {
Write('Hello World');
};
var f = {
Foo: Foo
}
return f;
}
var env = newEnv();
var foo = new env.Foo(); // Fails with "env.Foo is not a Type"
function newEnv () {
function Foo () {
Write('Hello World');
};
var f = {
Foo: Foo
}
return f;
}
var env = newEnv();
var Foo = env.Foo; // Assign to a new variable
var foo = new Foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.