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

jQuery Naming Variables

Hi, I'm quite new to jQuery & Javascript. I'm learning it since I'd like to have some autonomy on how I want my webpages to move / be interactive myself, rather than be dependent on another coder.

Regarding the naming of variables, as mentioned by Andrew, I understand that it would be more convenient to attribute "$" to a variable that you intend to use in jQuery more than Javascript, but I would like to know when is it best to use "$" or simple names without "$" in jQuery?

I noticed this because in the jQuery Utility Methods Code Challenge, the correct variable naming was:

var isValid = $('.required').map(function(){
    return $(this).val();
)}

which didn't use "$".

Thanks in advance! :)

1 Answer

Try reading this and see if it answers your question. http://api.jquery.com/jQuery/