Created
October 20, 2012 22:45
-
-
Save RobinStamer/3925095 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| > a = {}; b = {next: a}; c = {next: b}; d = {next:c}; a.next = d | |
| { next: { next: { next: [Object] } } } | |
| > a | |
| { next: { next: { next: [Object] } } } | |
| > JSON.stringify(a) | |
| TypeError: Converting circular structure to JSON | |
| at Object.stringify (native) | |
| at repl:1:7 | |
| at REPLServer.self.eval (repl.js:111:21) | |
| at Interface.<anonymous> (repl.js:250:12) | |
| at Interface.EventEmitter.emit (events.js:88:17) | |
| at Interface._onLine (readline.js:199:10) | |
| at Interface._line (readline.js:517:8) | |
| at Interface._ttyWrite (readline.js:735:14) | |
| at ReadStream.onkeypress (readline.js:98:10) | |
| at ReadStream.EventEmitter.emit (events.js:115:20) | |
| > function del(x) { delete x; console.log(++del.count); }; del.count = 0 | |
| 0 | |
| > entry = c; cur = entry.next; while (cur != entry) { next = cur.next; del(cur); cur = next } del(entry) | |
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| undefined | |
| > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment