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 trial

JavaScript

Am i right when i am thinking that the function f(){...}; inside test.app is a closure and test.change() also in test.ap

Hello i started with closures few days ago and i would like to know if i am on the right path. I ve read a lots of stuff also here but i feel that i need my own example . so this is my example : http://codepen.io/anon/pen/KVwWdz

Also why test.change() works differently in a codepen(text is red) and jsfiddle(text is not red)? Is it a bad code and jsfiddle has a problem with it ?

1 Answer

You have a little bit more going on in your example but I agree based on what I read on Mozilla.

In regards to jsfiddle, the example will work but you need to replace document.write and make sure to include the jQuery library as shown here.