Comments on: JavaScript: Bad Practices https://j11y.io/javascript/javascript-bad-practices/ Sun, 22 Mar 2015 15:39:22 +0000 hourly 1 https://wordpress.org/?v=5.0.13 By: Bryan Migliorisi https://j11y.io/javascript/javascript-bad-practices/#comment-1258 Mon, 02 Nov 2009 03:48:09 +0000 https://j11y.io/?p=1119#comment-1258 @John

‘JavaScript: The Good Parts’ by Douglas Crockford is great, but somewhat advanced.

http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742

]]>
By: John https://j11y.io/javascript/javascript-bad-practices/#comment-1257 Sun, 01 Nov 2009 18:59:56 +0000 https://j11y.io/?p=1119#comment-1257 Very nice article. By the way, can you tell us which book do you prefer to learn advanced JavaScript and things like in this article?
Thank you.

]]>
By: zafada https://j11y.io/javascript/javascript-bad-practices/#comment-1256 Mon, 19 Oct 2009 12:36:56 +0000 https://j11y.io/?p=1119#comment-1256 I agree with some but not all. I do not agree with the use of third party libraries, period. Inline JS is sometimes necessary so remember that.

]]>
By: Nate Eagle https://j11y.io/javascript/javascript-bad-practices/#comment-1255 Wed, 07 Oct 2009 18:42:07 +0000 https://j11y.io/?p=1119#comment-1255 Just wanted to say that I found the format of this entry–here’s what NOT to do–very helpful as a javascript beginner. I commit, to one degree or another, ALL of these sins in my javascript, and it’s very useful for me to see the signs of the way I do things now with a follow-up pointer to an improved method. Thanks!

]]>
By: Jay Garcia https://j11y.io/javascript/javascript-bad-practices/#comment-1254 Tue, 06 Oct 2009 12:37:54 +0000 https://j11y.io/?p=1119#comment-1254 @Dave,

Lea is right. If you know and follow the Java variable/method naming convention, you can’t go wrong.

]]>
By: Lea Verou https://j11y.io/javascript/javascript-bad-practices/#comment-1253 Sat, 19 Sep 2009 08:04:58 +0000 https://j11y.io/?p=1119#comment-1253

Then what’s your quick visual distinction between a variable and a method, hmm?

The entirely different semantics of the name?

]]>
By: Dave https://j11y.io/javascript/javascript-bad-practices/#comment-1252 Thu, 17 Sep 2009 17:23:48 +0000 https://j11y.io/?p=1119#comment-1252 “Only functions that are constructors should be identified with an initial captial letter, not regular functions.”

Then what’s your quick visual distinction between a variable and a method, hmm?

]]>
By: Kyle https://j11y.io/javascript/javascript-bad-practices/#comment-1251 Sat, 05 Sep 2009 04:37:16 +0000 https://j11y.io/?p=1119#comment-1251 I especially agree with your Having long HTML strings in your JavaScript point. Not only does inserting HTML with JavaScript rob you of any SEO value for some search engines, but it’s a bad practice if a user would have JavaScript disabled.

Overall, this is a great list. Thanks

]]>
By: Maicon https://j11y.io/javascript/javascript-bad-practices/#comment-1250 Fri, 28 Aug 2009 12:20:42 +0000 https://j11y.io/?p=1119#comment-1250 Very useful and elucidative article. Thank you for share.

]]>
By: James https://j11y.io/javascript/javascript-bad-practices/#comment-1249 Thu, 27 Aug 2009 11:21:22 +0000 https://j11y.io/?p=1119#comment-1249 @Sergey Chikuyonok, yes, using += on innerHTML is generally a bad idea but that wasn’t the point of the snippet – I was just demonstrating the effectiveness of joining HTML strings using a native method. And, frankly, on the inline-event-handlers issue, it’s each to his own – I for one don’t think the marginal performance benefits of inline handlers outweigh the benefit in having fully unobtrusive handlers.

@Mark van ‘t Zet, so who exactly are you accommodating to in your comments? Any proficient JavaScript developer should understand the following construct:

var fn = (function(){
    var something = {};
    return function(){
        // stuff
    };
})();

It’s illogical to constantly assume that the reader of your code is just a beginner – you should assume they have a very good knowledge of the language.

]]>