Created
July 28, 2017 19:57
-
-
Save anonymous/1ad2a3e787dde742828954b604cd8b11 to your computer and use it in GitHub Desktop.
null created by anonymous - https://repl.it/JnYY/0
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
const i = {}; | |
i.i = i; | |
console.log(i); | |
function I() { | |
this.i = this; | |
} | |
const functionI = new I(); | |
console.log(functionI); | |
const getterI = {}; | |
Object.defineProperty(getterI, "i", { | |
enumerable: true, | |
get: function returnSelf() { | |
return this; | |
}.bind(getterI), | |
}); | |
console.log(getterI); | |
const circularTest = {}; | |
circularTest.a = {}; | |
circularTest.b = { hello: "hello" }; | |
circularTest.a.b = circularTest.b; | |
circularTest.b.a = circularTest.a; | |
console.log(circularTest); | |
let circularObjects = [i, functionI, getterI, circularTest]; | |
let promises = circularObjects.map(i => { | |
return new Promise((resolve, reject) => | |
resolve(JSON.stringify(i))) | |
.then(console.log) | |
.catch(reason => { | |
console.log(i); | |
console.error(reason); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment