Long description

Back

The JavaScript code consists of 13 lines of code. Line 1: StartCommand let EndCommand c equals 0 semicolon, at indentation level 0, labeled 1. Note: global variable c is defined. Line 2: outer open parenthesis close parenthesis semicolon, at indentation level 0, labeled 2. Note: global function outer open parenthesis called parenthesis is called. Note: Line 1 and Line 2 belongs to the outer block labeled Anything declared inside this block is global and accessible everywhere in this block.

Line 3: function outer open parenthesis close parenthesis open curly brace, at indentation level 1. Line 4: function inner open parenthesis close parenthesis open curly brace, at indentation level 2. Line 5: console dot log open parenthesis “a” close parenthesis semicolon, at indentation level 3, labeled 5. Note: local open parenthesis outer close parenthesis variable “a” is accessed. Line 6: StartCommand let EndCommand b equals 23 semicolon, at indentation level 3, labeled 6. Note: local open parenthesis inner close parenthesis variable b is defined. Line 7: c equals 37 semicolon, at indentation level 3, labeled 7. Note: global variable c is changed. Line 8: close curly brace, at indentation level 2. Note: Line 5, 6, and 7 belongs to the inner block labeled Anything declared inside this block is accessible only in this block. Line 9: StartCommand let EndCommand “a” equals 5 semicolon, at indentation level 2, labeled 3. Note: local open parenthesis outer close parenthesis variable “a” is defined An arrow labeled allowed and outputs 5 points from line 5 to line 9. Line 10: inner open parenthesis close parenthesis semicolon, at indentation level 2, labeled 4. Note: local function inner open parenthesis close parenthesis is called. Line 11: console dot log open parenthesis c close parenthesis semicolon, at indentation level 2, labeled 8. Note: global variable c is accessed. Line 12: console dot log open parenthesis b close parenthesis semicolon, at indentation level 2, labeled 9. Note 1: undefined variable b is accessed. Note 2: Line 12 generates error or outputs undefined. Line 13: close curly brace, at indentation level 2. An arrow labeled not allowed points from line 12 to line 6. An arrow labeled allowed and outputs 37 points from line 7 and 11 to line 1. Note: Line 3, 9,10,11,12, and 13 belongs to the middle block labeled Anything declared inside this block is accessible everywhere within this block.

Back