128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

I’m trying to get a start here on Codecanyon and I want to know if there are any coding guidelines that I should follow for JavaScript files (or any other file). I’m especially curious if I should follow a specific commenting convention for classes?

Thank you,

Alex

320 posts
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • United States
jwmcpeak says

Just follow good, industry standard practices and you’ll be fine. Comments are secondary and usually not a factor if an item is accepted or rejected.

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

Just follow good, industry standard practices and you’ll be fine. Comments are secondary and usually not a factor if an item is accepted or rejected.

Thanks for the info. Cheers

56 posts
  • United Kingdom
  • Most Wanted Bounty Winner
  • Sold between 1 000 and 5 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Bought between 1 and 9 items
JMDDesigns says

As you probably already know some of this, it might not help; but it’s the same principle for anything code-based written.

Simple School Boy Guidelines:
1.Keep your code clean and cluster free. 2. Use shorthand code instead of writing everything our separately; use wherever possible.
For example:

$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2').css('color', '#fff');
                        $('.div3').css('color', '#fff');
                        $('.div4').css('color', '#fff');
    })
});


Would become:
$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2, .div3, .div4').css('color', '#fff');
    })
});

I could go on and on and on, about using (this) and (that) forever, but here is a great practice site here:
http://www.jameswiseman.com/blog/2010/04/20/jquery-standards-and-best-practice/
It’s got practically everything you need.
128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

As you probably already know some of this, it might not help; but it’s the same principle for anything code-based written
.... I could go on and on and on, about using (this) and (that) forever, but here is a great practice site here:
http://www.jameswiseman.com/blog/2010/04/20/jquery-standards-and-best-practice/
It’s got practically everything you need.

Every infromation is usefull. Although there are tons of resources out thereI thought maybe here on codecanyon there are some specific guidelines/rules to follow.

Thanks for your reply.

101 posts
  • Australia
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
pjtops says

For Javascript, jslint (http://www.jslint.com/) can help a lot in keeping your code consistent, and even catching some bugs along the way.

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

For Javascript, jslint (http://www.jslint.com/) can help a lot in keeping your code consistent, and even catching some bugs along the way.

Great. Thanks for sharing! :)

5313 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 more
CodingJack says

I prefer http://www.jshint.com/

I also hate using anonymous functions and coming from AS3 you probably will too :D

Good luck :)

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

I prefer http://www.jshint.com/

I also hate using anonymous functions and coming from AS3 you probably will too :D

Good luck :)

Yup… It’s a pain. But what can you do? Need to move on with industry standards (?).

Also, thank you!

23 posts
  • Elite Author
  • Europe
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 000 and 250 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Exclusive Author
  • Has been a member for 2-3 years
OnePress says


Would become:
$(function(){    
    $('#div').on('click', function() {
        $('#div').css('background-image', 'url(img/folder/file.png)');
            $('.div2, .div3, .div4').css('color', '#fff');
    })
});

Do you really use the jquery css method to set a background image and to change colors?

by
by
by
by
by
by