Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTsenko Aleksiev
3,819 PointsLocal global variable?
Hi, I made the code work, this is my solution: https://jsfiddle.net/upamL256/ Can you please explain me, why if the oList var is global the code crashes. I know the difference between the local and global vars but I can't understand why it makes so big difference in this example.
1 Answer
Tsenko Aleksiev
3,819 PointsOk, I got it: when the oList var is declared outside and it has "<ol>" asigned to it, the second time I got in the function it doesn't have only the opening tag inside it, wright?