-
Notifications
You must be signed in to change notification settings - Fork 0
/
callout-stack.draft.js
52 lines (46 loc) · 2.06 KB
/
callout-stack.draft.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const calloutStack = (msg = '') =>
// inspiration: https://github.com/angus-c/literary.js/blob/master/book/carroll/prime.js
eval(
msg
.split('')
.reduce((acc, next) => `(function ${next}() { ${acc} })()`, `${msg}()`),
);
const calloutStack = (msg = '') =>
eval(
msg
.split('')
.reduce((acc, next) => `(function ${next}() { ${acc} })()`, msg),
);
// console.log(calloutStack);
calloutStack('notice');
// VM4673:1 Uncaught ReferenceError: notice is not defined
// at n (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:97)
// at o (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:108)
// at t (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:113)
// at i (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:118)
// at c (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:123)
// at e (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:128)
// at eval (eval at calloutStack (callout-stack.js:8:3), <anonymous>:1:133)
// at calloutStack (<anonymous>:8:3)
// at <anonymous>:16:13
// at HTMLIFrameElement.evaller.onload (study-with.js:63:34)
// const calloutStack = (msg = '') =>
// new Function(
// 'msg=""',
// `return function ${msg.slice(0, 1)}(msg = '') {
// msg.length === 0
// ? msg()
// : calloutStack(msg.slice(1, msg.length))
// }`,
// )()(msg);
// VM144:5 Uncaught TypeError: msg is not a function
// at eval (eval at calloutStack (callout-stack.js:7:3), <anonymous>:5:19)
// at calloutStack (<anonymous>:14:6)
// at e (eval at calloutStack (callout-stack.js:7:3), <anonymous>:6:19)
// at calloutStack (<anonymous>:14:6)
// at c (eval at calloutStack (callout-stack.js:7:3), <anonymous>:6:19)
// at calloutStack (<anonymous>:14:6)
// at i (eval at calloutStack (callout-stack.js:7:3), <anonymous>:6:19)
// at calloutStack (<anonymous>:14:6)
// at t (eval at calloutStack (callout-stack.js:7:3), <anonymous>:6:19)
// at calloutStack (<anonymous>:14:6)