Successfully reported this slideshow.

Comments about Eloquent JavaScript: chapters 2 and 3

894 views

Published on

Comments about Eloquent JavaScript: chapters 2 and 3

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Comments about Eloquent JavaScript: chapters 2 and 3

  1. 1. Javascript Tricky stuffEloquent JavaScript - Chapters 2 and 3
  2. 2. Variables comparison• null == undefined• false == 0• “” == 0• “5” == 5• Use === or !==
  3. 3. Boolean expressions• 0, “”, null, undefined, NaN equiv. to false• anything else equiv. to true
  4. 4. Automatic type conversion• “patata”+5• null + “torious”• “4” * 4 --> Number(“4”) * 4• 4 * “patata”• typeof NaN ?• https://www.destroyallsoftware.com/talks/ wat
  5. 5. NaN• NaN == NaN ?• isNaN• isNaN(“3”) ?
  6. 6. && ||• var output = (input || “is input is false”)• var output = (input && “input is true”)• Evaluates the first part of the expression, the second part only if necessary
  7. 7. Scope of variables• Global• Local• var name OR name• Closure•
  8. 8. Efficiency• Recursion vs loops
  9. 9. Functions• Anonymous• Arguments variable

×