JavaScript - Good Parts and Bad Parts

javascript

Good Parts:

1. Functions are first class objects:
   a. We can pass functions as parameters
   b. We can return function as result of a function
   c. We can assign properties to functions
   d. Functions are really objects

2. Loose typing:  Most programming language demands strong typing.  The theory
   is that strong typing allows a compiler to detect a large class of errors
   at compile time.  The sooner we can detect and repair errors, the less they 
   cost us.  JavaScript is a loosely typed language, so JavaScript compilers
   are unable to detect type errors.  This can be alarming to people who are
   coming to JavaScript from a strongly typed languages.  But it turns out that
   strong typing does not eliminate the need for careful testing.  And I have
   found in my work that the sorts of errors that strong type checking find are
   not the errors I worry about.  On the other hand, I find loose typing to be
   liberating.  I do not need to form a complex class hierarchies.  And I never
   have to cast or wrestle with the type system to get the behavior that I
   want. -- Douglas Crockford - "JavaScript: The Good Parts"

3. Dynamic objects.

4. Expressive object literal notation:  JavaScript has a very powerful object
   literal notation.  Objects can be created simply by listing their 
   components.

Bad Parts:

1. Global variables.

Controversial Parts:

1. Prototypal Inheritance
Function.prototype.method = function (name, func) {
  this.prototype[name] = func;
  return this;
}

The above code is used to define new methods.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License