-
-
Save cutecycle/0fe47bc6cd5427c0e3ccc94fa4122f58 to your computer and use it in GitHub Desktop.
Scope issue?
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 = function () { | |
console.log('hi'); | |
} | |
function b() { | |
console.log('eh whatever'); | |
debugger; | |
} | |
b(); |
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 = function () { | |
console.log('hi'); | |
} | |
function b() { | |
c = function () { | |
console.log('yikes') | |
} | |
function d() { | |
console.log('jinkies') | |
} | |
console.log('eh whatever'); | |
debugger; | |
} | |
b(); | |
--------------------------------------------------------------------- | |
Break in C:\Users\cutecycle\Box Sync\Projects\couriers\test | |
.js:8 | |
6 function b() { | |
7 console.log('eh whatever'); | |
> 8 debugger; | |
9 } | |
10 b(); | |
debug> repl | |
Press Ctrl + C to leave debug repl | |
> a() | |
< hi | |
> c() | |
ReferenceError: c is not defined | |
> d() | |
ReferenceError: d is not defined | |
> |
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
state = {} | |
a = function () { | |
console.log('hi'); | |
} | |
function b(state) { | |
c = function () { | |
console.log('yikes') | |
} | |
function d() { | |
console.log('jinkies') | |
} | |
console.log('eh whatever'); | |
debugger; | |
console.log('hi bb') | |
} | |
b(state); | |
break in C:\Users\cutecycle\Box Sync\Projects\couriers\test.js:15 | |
13 } | |
14 console.log('eh whatever'); | |
>15 debugger; | |
16 console.log('hi bb') | |
17 } | |
debug> repl | |
Press Ctrl + C to leave debug repl | |
> a() | |
< hi | |
> c() | |
< yikes | |
> d() | |
< jinkies | |
> |
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
function a() { | |
console.log('hi'); | |
} | |
function b() { | |
console.log('eh whatever'); | |
debugger; | |
} | |
b(); |
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
function uni_fire(playernumber, handnumber, state) { | |
state.deck.push(state.player[playernumber].hand[handnumber]); | |
state.player[playernumber].hand.splice(handnumber, 1); | |
return state; | |
} | |
function init(state) { | |
state.deck = constructdeck(); | |
state.totalticks = 0; | |
state.clock = 0; | |
state.packages = [].fill({ | |
owner: null | |
}, 0, 9); | |
state.player = [] | |
state.player[0] = {} | |
state.player[0].hand = []; | |
state.player[1] = {} | |
state.player[1].hand = []; | |
state = deck_deal(state); | |
debugger; | |
console.log("hello"); | |
return state; | |
} | |
state = init(state); | |
------------------------------------------------------------------------- | |
break in C:\Users\cutecycle\Box Sync\Projects\couriers\game.js:204 | |
202 state.player[1].hand = []; | |
203 state = deck_deal(state); | |
>204 debugger; //state = uni_fire(0,0,state); | |
205 //debugger; | |
206 console.log("hello"); | |
debug> repl | |
Press Ctrl + C to leave debug repl | |
> uni_fire(0,0,state) | |
ReferenceError: uni_fire is not defined | |
> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment