JavaScript: enter the dragon

5,167 views

Published on

JavaScript: enter the dragon

  1. 1. JavaScript
  2. 2. JavaScriptEnter the Dragon
  3. 3. Most misunderstood language
  4. 4. You have no choice
  5. 5. …but you have plenty of options
  6. 6. JavaScript
  7. 7. JavaScript human body
  8. 8. “If you have a body, you are an athlete” Bill Bowerman, co-founder of Nike.
  9. 9. If you code for the Web,you are a JavaScript Developer
  10. 10. Control
  11. 11. Why you “unfit”?
  12. 12. Why your JavaScript sucks?
  13. 13. “This is not important”“I don’t need it any more, it’s XXI century” “I am good enough!” “It’s way too complicated” “I don’t have time for this”
  14. 14. Kyle Maynard — MMA fighter
  15. 15. Kyle Maynard — MMA fighter
  16. 16. Kyle Maynard — MMA fighterExcuses… Let’s hear yours again
  17. 17. There are no shortcuts
  18. 18. “Those who are unaware they are walking in darkness will never seek the light.” Bruce Lee
  19. 19. Six essential bits
  20. 20. Six pack
  21. 21. 1Types & type coercion
  22. 22. object number string boolean nullundefined
  23. 23. 5 - "4"5 + "4"+!{}[true]+[1]+[1, 2]7 - "a"7 / 0…
  24. 24. 2 Operators,especially “+” & “==”
  25. 25. 5 + "4"5 + null4 == "4.00"null == undefined0 == false0 == nullnull == false
  26. 26. typeof null == "object"typeof function () {} == "function"
  27. 27. 3Objects & primitives
  28. 28. var a = "string";alert(a.length);a.t = 3;alert(a.t);
  29. 29. 4Functions & constructors
  30. 30. function f() {};var a = f , b = f(), c = new f , d = f(f);
  31. 31. 5Closures
  32. 32. function add(a) { return function (b) { return a + b; };}add(3)(4) == 7
  33. 33. 6Prototype
  34. 34. Prototypes in JavaScript in 5 minutes
  35. 35. function f() {}; f P
  36. 36. function f() {};f.prototype.x = 3; f P x: 3
  37. 37. function f() {};f.prototype.x = 3; f P x: 3var a = new f; a
  38. 38. function f() {};f.prototype.x = 3; f P x: 3var a = new f;a.x = 2;a.y = 1; a x: 2 y: 1
  39. 39. function f() {};f.prototype.x = 3; f P x: 3var a = new f;a.x = 2;a.y = 1; a bvar b = new f; x: 2 y: 1
  40. 40. function f() {};f.prototype.x = 3; z: 0 P2 f P x: 3var a = new f;a.x = 2;a.y = 1; a bvar b = new f; x: 2f.prototype = {z: 0}; y: 1
  41. 41. function f() {};f.prototype.x = 3; z: 0 P2 f P x: 3var a = new f;a.x = 2;a.y = 1; c a bvar b = new f; x: 2f.prototype = {z: 0}; y: 1var c = new f;
  42. 42. function f() {};f.prototype.x = 3; z: 0 P2 f P x: 3var a = new f;a.x = 2;a.y = 1; c a bvar b = new f; x: 2f.prototype = {z: 0}; y: 1var c = new f; b.constructor == f c.constructor == Object
  43. 43. I didn’t get it…
  44. 44. Function.constructor == Function
  45. 45. Nobody knows what to do
  46. 46. http://www.udel.edu/anthro/neitzel/supplemental%20sportsS09.htm
  47. 47. Different goalsdemand different approaches
  48. 48. Form always follows the function
  49. 49. http://www.flickr.com/photos/sgroi/3228398172/
  50. 50. http://en.wikipedia.org/wiki/Hercules_of_the_Forum_Boarium
  51. 51. http://www.flickr.com/photos/stebbz/2451346427/
  52. 52. Thank You
  53. 53. “A wise man can learn more from a foolish question than a fool can learn from a wise answer.”Bruce Lee
  54. 54. “If you spend too much time thinking about a thing, you’ll never get it done.” Bruce Lee

×