Jump to content

Using vars for shorthand of objects - reducing file size

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...