Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 16
added 18 characters in body; edited body; deleted 157 characters in body
bobince
  • 538.1k
  • 111
  • 675
  • 846

Not jQuery. Not YUI. Not Prototype.

Frameworks may be useful, but they are often hiding the sometimes-ugly details of how JavaScript and the DOM actually work from you. If your aim is to be able to say "I know JavaScript", then investing a lot of time in a framework is opposed to that.

Here are some JavaScript language features that you should know to grok what it's doing and not get caught out, but which aren't immediately obvious to many people:

  • That object.prop and object['prop'] are the same thing (so can you please stop using eval, thanks); that object properties are always strings (even for arrays); what for...in is for (and what it isn't).

  • Property-sniffing; what undefined is; why it was a dreadful mistake; why the seemingly-little-known in operator is beneficial and different from typeof/undefined checks; hasOwnProperty; the purpose of delete.

  • Nested function scoping; how it can be used for closures; the necessity of using var in the scope you want.

  • How global variables and window properties collide; how global variables and document elements shouldn't collide but do in IE; the necessity of using var in global scope too.

  • How the function statement acts to ‘hoist’ a definition before code preceding it; the difference between function statements and function expressions; why named function expressions should not be used.

  • How constructor functions, the prototype property and the new operator really work; methods of exploiting this to create the normal class/subclass/instance system you actually wanted; when you might want to use closure-based objects instead of prototyping. (Most JS tutorial material is absolutely terrible on this; it took me years to get it straight in my head.)

  • How this is determined at run-time; how consequently method-passing doesn't work like you expect from other languages; how closures or Function#bind may be used to get around that.

  • Other ECMAScript Fifth Edition features like indexOf, forEach and the functional-programming methods on Array; how to fix up older browsers to ensure you can use them; using them with inline anonymous function expressions to get compact, readable code.

  • Synchronous and asynchronous execution; the flow of control between the browser and user code.

  • How cross-window scripting affects instanceof; how cross-window scripting affects the control flow across different documents.

bobince
  • 538.1k
  • 111
  • 675
  • 846

AltStyle によって変換されたページ (->オリジナル) /