Skip to content

Commit 91db58a

Browse files
committed
more
1 parent be425c1 commit 91db58a

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{ code: '// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\n\n// define MY_FAV as a constant and give it the value 7\nconst MY_FAV = 7;\n\n// will print 7\nconsole.log("my favorite number is: " + MY_FAV);\n\n// MY_FAV is still 7\nconsole.log("my favorite number is " + MY_FAV);\n\n// Assigning to A const variable is a syntax error\nconst A = 1;\n\n// const also works on objects\nconst MY_OBJECT = {"key": "value"};\n\n// Overwriting the object fails as above (in Firefox and Chrome but not in Safari)\nMY_OBJECT = {"OTHER_KEY": "value"};',
2+
trace:
3+
[ { stdout: '',
4+
func_name: '',
5+
stack_to_render: [],
6+
globals: {},
7+
ordered_globals: [],
8+
line: 4,
9+
col: 0,
10+
event: 'step_line',
11+
heap: {} },
12+
{ stdout: '',
13+
func_name: '',
14+
stack_to_render: [],
15+
globals: {},
16+
ordered_globals: [],
17+
line: 7,
18+
col: 0,
19+
event: 'step_line',
20+
heap: {} },
21+
{ stdout: 'my favorite number is: 7\n',
22+
func_name: '',
23+
stack_to_render: [],
24+
globals: {},
25+
ordered_globals: [],
26+
line: 10,
27+
col: 0,
28+
event: 'step_line',
29+
heap: {} },
30+
{ stdout: 'my favorite number is: 7\nmy favorite number is 7\n',
31+
func_name: '',
32+
stack_to_render: [],
33+
globals: {},
34+
ordered_globals: [],
35+
line: 13,
36+
col: 0,
37+
event: 'step_line',
38+
heap: {} },
39+
{ stdout: 'my favorite number is: 7\nmy favorite number is 7\n',
40+
func_name: '',
41+
stack_to_render: [],
42+
globals: {},
43+
ordered_globals: [],
44+
line: 16,
45+
col: 0,
46+
event: 'step_line',
47+
heap: {} },
48+
{ stdout: 'my favorite number is: 7\nmy favorite number is 7\n',
49+
func_name: '',
50+
stack_to_render: [],
51+
globals: {},
52+
ordered_globals: [],
53+
line: 19,
54+
col: 0,
55+
event: 'step_line',
56+
heap: {} },
57+
{ exception_msg: 'TypeError: Assignment to constant variable.',
58+
stdout: 'my favorite number is: 7\nmy favorite number is 7\n',
59+
func_name: '',
60+
stack_to_render: [],
61+
globals: {},
62+
ordered_globals: [],
63+
line: 19,
64+
col: 10,
65+
event: 'exception',
66+
heap: {} } ] }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
2+
3+
// define MY_FAV as a constant and give it the value 7
4+
const MY_FAV = 7;
5+
6+
// will print 7
7+
console.log("my favorite number is: " + MY_FAV);
8+
9+
// MY_FAV is still 7
10+
console.log("my favorite number is " + MY_FAV);
11+
12+
// Assigning to A const variable is a syntax error
13+
const A = 1;
14+
15+
// const also works on objects
16+
const MY_OBJECT = {"key": "value"};
17+
18+
// Overwriting the object fails as above (in Firefox and Chrome but not in Safari)
19+
MY_OBJECT = {"OTHER_KEY": "value"};

0 commit comments

Comments
 (0)