Monday, November 9, 2015

Good parts of the book "JavaScript: The Good Parts"

Below is a summary of this excellent book "JavaScript: The Good Parts" by Douglas Crockford .
  • Logical Condition : the falsy values are false ,null ,undefined ,empty string , the number 0 and number NaN and other values true,the string 'false' and all objects are all truthy
  • Use the operator || can be used to fill in default values
  • One way to minimize the use of global variables is to create a single global variablefor your application: var MYAPP = {};
  • The functions are objects, they can be used like any other value. Functions can be stored in variables, objects, and arrays. Functions can be passed as arguments to functions, and functions can be returned from functions. Also, since functions are objects, functions can have methods.
  • There is no type checking on the argument values: any type of value can be passed to any parameter
  • A function always returns a value. If the return value is not specified, then undefined is returned. If the function was invoked with the new prefix and the return value is not an object,then this (the new object) is returned instead.
  • JavaScript does have function scope. That means that the parameters and variables defined in a function are not visible outside of the function, and that a variable defined anywhere within a function is visible everywhere within the function.
  • In many modern languages, it is recommended that variables be declared as late as possible, at the first point of use. That turns out to be bad advice for JavaScript because it lacks block scope. So instead, it is best to declare all of the variables used in a function at the top of the function body.
  • Functions as first class objects :Functions in Simplified JavaScript are lambdas with lexical scoping 
  • Dynamic objects with prototypal inheritance :Objects are class-free. We can add a new member to any object by ordinary assignment. An object can inherit members from another object.
  • Object literals and array literals This is a very convenient notation for creating new objects and arrays.
  • It is adviced to never use the evil twins. Instead, always use === and !==. All of the comparisons just shown produce false with the === operator.
  • The with statement should be avoided
  • Don’t use new Boolean or new Number or new String. Also avoid new Object and new Array. Use {} and [] instead.
  • Its better not to use new at all
  • Avoid Void 

1 comment:


  1. Just wish to say your article is as astounding. The clearness in your
    submit is just excellent and i can suppose you’re knowledgeable in this subject.
    Well along with your permission allow me to take hold of your RSS feed to stay up
    to date with drawing close post. Thanks a million and
    please carry on the rewarding work.
    Also See:
    AngularJS Certification Training in Chennai

    ReplyDelete