# www.w3schools.com/js/js_timing.asp. var t=setTimeout("javascript statement",milliseconds); This is terrible advice. You never pass a string to setTimeout() unless you like using eval() . Passing a string also means, among other things, that you can't use any variables from your local scope. Also, the examples on this page use a ton of global variables. Bad.

# www.w3schools.com/js/js_browser.asp. Sometimes it can be useful to detect the visitor's browser, and then serve the appropriate information. The best way to do this is to make your web pages smart enough to look one way to some browsers and another way to other browsers. Abysmal. User-agent sniffing is a very bad thing, because it is easily spoofable. This applies equally to the window.navigator object. <script type="text/javascript"> document.write("Browser CodeName: " + navigator.appCodeName); document.write("<br /><br />"); document.write("Browser Name: " + navigator.appName); document.write("<br /><br />"); document.write("Browser Version: " + navigator.appVersion); document.write("<br /><br />"); document.write("Cookies Enabled: " + navigator.cookieEnabled); document.write("<br /><br />"); document.write("Platform: " + navigator.platform); document.write("<br /><br />"); document.write("User-agent header: " + navigator.userAgent); </script> W3Schools uses document.write() in a lot of their examples; unfortunately, it has a tendency to trash a page and is one of the poorest ways possible to add content. It also means that you can't defer/asynchronously load any other scripts, and your DOM loading is delayed because the browser has to wait for your document.write() .

# www.w3schools.com/jsref/met_win_setinterval.asp. No warning about what happens when the callback takes longer than the given interval.

# www.w3schools.com/jsref/jsref_eval.asp. First, eval() determines if the argument is a valid string, then eval() parses the string looking for JavaScript code. If it finds any JavaScript code, it will be executed. eval() certainly does not parse a string to determine whether or not it's JavaScript. W3Schools recently updated their description, but it is still wrong. If the argument is an expression, eval() evaluates the expression. If the argument is one or more JavaScript statements, eval() executes the statements. You do not pass an expression or a JavaScript statement to eval() , but rather a string, which typically represents an expression or statement. The expression/statement represented by the string is executed. In fact, if you do not pass a string to eval() , the argument is returned unchanged. Worst of all, W3Schools irresponsibility fails to educate users on why eval() is a dangerous function to use and is inappropriate for most use cases. Nor is there any mention of safer alternatives.

# www.w3schools.com/JS/js_statements.asp. JavaScript code (or just JavaScript) is a sequence of JavaScript statements. Apparently declarations and expressions can go right to hell (since JavaScript only is a sequence of statements). Each statement is executed by the browser in the sequence they are written. This is not exactly true, either, as JavaScript hoists variable and function declarations, meaning that those declarations are not defined in sequence. JavaScript Blocks This section mentions nothing about JavaScript not having block scope even though its block syntax suggests that it does. The example above is not very useful. lol whut?!

# www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax2. async: false The first "A" in AJAX stands for "asynchronous" (or non-blocking). Promoting setting the async property to false when calling jQuery's ajax method without any context in an example that is likely to be copy/pasta'd around the net is grossly irresponsible.

# www.w3schools.com/js/js_functions.asp. If you declare a variable within a function, the variable can only be accessed within that function. When you exit the function, the variable is destroyed. The whole concept of closures doesn't exist at W3Schools… Also, they never go over the difference between a function declaration and a function expression. I know this is for beginners, but they could at least put it in the advanced section, or make it apparent that functions are first-class?

# www.w3schools.com/js/js_objects.asp. personObj=new Object(); This is a bad and unnecessary use of the new keyword. They should be using and advocating the object literal syntax ( {} ) for creating new objects. Create a template of an object. The template defines the structure of an object. This is the wrong name for an object constructor. They also don't explain that calling the constructor using new will return a new object.

# www.w3schools.com/js/js_obj_boolean.asp. var myBoolean=new Boolean(); This code is completely useless. It is slower, larger, and causes all sorts of problems compared to straight-up true and false . If you use new Boolean() , typeof will return "object" instead of "boolean", and strict equality operators will fail. var myBoolean=new Boolean(); var myBoolean=new Boolean(0); var myBoolean=new Boolean(null); var myBoolean=new Boolean(""); var myBoolean=new Boolean(false); var myBoolean=new Boolean(NaN); You can coerce any value to a boolean by using a double-unary operator (e.g. !!null , !!0 , etc.). It's shorter, and it gives you a proper primitive instead of a boxed Boolean object (which, as mentioned above, will not act like you expect).

# www.w3schools.com/js/js_loop_for.asp. for (var=startvalue;var<=endvalue;var=var+increment) Not only do they forget about using the var keyword to prevent the variable from leaking to the global scope, but you can't even use var as a variable name—it is a reserved word, and this code will generate a SyntaxError.

# www.w3schools.com/js/js_summary.asp. Now You Know JavaScript, What's Next? […] If you want to learn about server-side scripting, the next step is to learn ASP or PHP. ASP Classic was discontinued in 2000 and replaced with C#/ASP.NET. Recommending people learn an outdated language is not a good next step.

# www.w3schools.com/js/js_loop_for_in.asp. Use the for...in statement to loop through an array: This is wrong. You should never use for..in to loop through an array, since it will enumerate any properties or methods that are attached to Array.prototype (or the Array object itself). This page also completely fails to mention the use of Object.prototype.hasOwnProperty() to avoid enumerating properties set on the object’s prototype. The variable argument can be a named variable, an array element, or a property of an object. Why would you ever do this? Why would you even say it is possible?

# www.w3schools.com/js/js_whereto.asp. Scripts in <head> In older browsers, placing scripts in the <head> has a negative impact on page performance. Until the script is done loading, resources below the script are blocked from downloading, and elements below the script are blocked from rendering. So try to put scripts at the bottom of the page, when possible. If you don't want your script to be placed inside a function, or if your script should write page content, it should be placed in the body section. Whaaat? This doesn't make sense. There is no requirement for scripts to be placed inside functions when they are in the <head> , though it is a great idea to do that to avoid polluting the global scope.

# www.w3schools.com/jsref/jsref_regexp_compile.asp. The compile method has been deprecated for some time now.

# www.w3schools.com/js/js_intro.asp. JavaScript's official name is ECMAScript. Technically… JavaScript is a trademark originally registered by Sun Microsystems and licensed to Netscape when the language was new. Sun was acquired by Oracle, which now owns the trademark, and Netscape passed the license for the trademark on to Mozilla. The language was eventually standardized under the creative name ECMAScript by the ECMA international standards organization to avoid legal conflicts with the trademark owner. Similarly, Microsoft named its clone of JavaScript, JScript. Meanwhile, JavaScriptCore, the implementation of ECMAScript in Apple's Safari, appears to be willing to take the chance, and Google's v8 is off doing its own thing being awesome and breaking the mould, man. To put it… plainly, JavaScript is a subset (or superset, depending upon which version of JS you are describing) of ECMAScript. :)

# www.w3schools.com/jsref/jsref_obj_regexp.asp. var txt=/pattern/modifiers; Assigning an RegExp object to a variable named txt is quite confusing. Also, weren't octals removed for escape sequences in ES5? Also also, no mention of non-capturing submatches.

# www.w3schools.com/JS/js_obj_array.asp. It lists new Array() as the way to create an array. The problem is that this is the old, slower way. The new way, [] is shorter and it makes you look cool.

# www.w3schools.com/js/js_form_validation.asp. Use of generally discouraged with() , use of global variables, use of JavaScript in HTML attribute ( onsubmit="" ) etc. Very last century. Also, the if() could be simplified to simply if (!value) - in its current form, it's likely to perpetuate some of the misunderstandings people tend to have about JavaScript.

# www.w3schools.com/JS/js_howto.asp The document.write() command is a standard JavaScript command for writing output to a page. This is on the second section and they never explain the danger of using document.write()

# www.w3schools.com/js/js_image_maps.asp What in the world does this have to do with JavaScript?

# www.w3schools.com/js/js_animation.asp This is not animation. This is not even something that you should be using JS for. Ever. Example could be done with CSS :hover .

# www.w3schools.com/js/tryit.asp?filename=tryjs_animation. Bad "animation" example. Again, example could be done in CSS.

# www.w3schools.com/js/js_variables.asp Claims that x = … and var x = … are the "same". They are obviously not (http://goo.gl/rXrY7). On that note, W3Schools doesn't mention variable scoping at all… This page is even worse, it actually goes out of its way to demonstrate that redeclaring an already-declared variable is safe. People shouldn't be doing this! You shouldn't be mentioning it like it's OK!

# www.w3schools.com/ajax/ajax_xmlhttprequest_create.asp Beginners would probably copy and paste the code which lacks var statements and would add evil globals.

# www.w3schools.com/js/js_events.asp Encouraging the use of inline event handlers. Also no mention of event bubbling or event.stopPropagation() . The wise bot from #jquery once said: Inline handlers are harder to debug, aren't reusable, are harder to maintain, bloat your HTML, and violate the separation of content design principle. Also - jQuery can't normalize your event, leaving you unsure if you can reliably event.stopPropagation() , or access event.which .

# www.w3schools.com/js/js_special_characters.asp That's weird, I am pretty sure that ampersands are not characters that need to be escaped in JS strings, but maybe I have been doing it wrong this whole time!?!? Maybe they meant that it is an HTML special character, so using it in JS blocks inside the HTML document can cause problems.