3-terrarium/3-intro-to-DOM-and-closures/README #556
ultrasounder
started this conversation in
General
Replies: 3 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
hi, if you read the lesson text, indeed, an error will be thrown. The lesson is about how to avoid this type of problem by using closures. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi working through this and found a bug. The
function displayCandy(){ let candy = ['jellybeans']; function addCandy(candyType) { candy.push(candyType) } addCandy('gumdrops'); } displayCandy(); console.log(candy)
throws an error as the displayCandy function expects the console.log statement to be inside the function body. It should be like this;
function displayCandy(){ let candy = ['jellybeans']; function addCandy(candyType) { candy.push(candyType) } addCandy('gumdrops'); console.log(candy) } displayCandy();
I ran this in Codepen and confirmed the result. Would be glad to submit a PR.
Beta Was this translation helpful? Give feedback.
All reactions