Jump to content

Using vars for shorthand of objects - reducing file size


Jared
 Share

Recommended Posts

Hello All, So you frequently see reductions with commonly used objects such as:

var $this = $(this)//Or....var $objectName = $('.className')

Is there any places or reason why you would chose to use the $ before the var name to create an object as oppose to just making a normal variable? I'm looking to find and replace the objects with these sorts of variables to reduce file size, make it easier to read, and hopefully speed up load time but to check with experts before I potentially F#$! up my work. Thoughts? Also, any thoughts on how to structure code (in general) to run most efficiently would be helpful. I auditioned a very scant, un-skinned version of my page on the server and it took much longer than I expected to load (on my itty bitty netbook of which I think some cell phones have more processing power). Thanks!

Edited by Jared
Link to comment
Share on other sites

it has nothing to do with what type of variable it will, that all depends on what is on the right side of the assignment operator. It is most likely a note/indicator/reminder to the author that the variable is a jquery object/variable.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...