Created
March 24, 2017 18:32
-
-
Save ben-ng/fc0a63ed58dd2fd130f09c6d2cda49b9 to your computer and use it in GitHub Desktop.
Salesforce Marketing Cloud constructor-from-closure bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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