Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Java エンジニアのためのJavaScript講座

Java エンジニアのためのJavaScript講座

Takeshi Kawajiri

April 24, 2013
Tweet

Other Decks in Technology

Transcript

  1.          

        ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭ ࡭
  2. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ม਺એݴ
  3. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ؔ਺એݴ
  4. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 Ҿ਺ ฦΓ஋
  5. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ֎෦ม਺ͷࢀর
  6. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ؔ਺ݺͼग़͠
  7. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ࣝผࢠ
  8. var a = 1; function func(b) { return a +

    b; } func(10); //=> 11 ਺஋
  9. var n = new Number(1); n["prop1"] = 1; n["prop1"]; //=>

    1 n.prop2 = 2; n.prop2; //=>2 Ç QSPQ O  QSPQ 
  10. var obj = new Object; obj.a = 1; obj.a; //=>

    1 var obj = { a: 1 }; obj.a; //=>1
  11. var arr = new Array; arr[0] = 1; arr[0]; //=>

    1 var arr = [1, 2]; arr[0]; //=> 1
  12. var arr = [1, 2]; arr[100] = 3; arr.a =

    1;  BSS      B 
  13. var obj = { m: function(a) { return a +

    1; } }; obj.m(1); //=> 2
  14. var a, b = 1; a = 2; function c(d)

    { var e = 5; } c(2);
  15. var a, b = 1; a = 2; function c(d)

    { var e = 5; } c(2);
  16. var a, b = 1; a = 2; function c(d)

    { var e = 5; } c(2);
  17. var a = 1; function f1() { var b =

    2; function f2() { var c = 3; }; }
  18. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  19. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 OFXࣜ
  20. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 ίϯετϥΫλ
  21. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 Πϯελϯε
  22. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 ϓϩτλΠϓ
  23. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 ϝιου
  24. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  25. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  26. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12 OFX0CKFDU
  27. var n = new Number(1); n instanceof Number; //=> true

    n.__proto__ = String.prototype n instanceof Number; //=> false n instanceof String; //=> true
  28. var n = new Number(1); n instanceof Number; //=> true

    n.__proto__ = String.prototype n instanceof Number; //=> false n instanceof String; //=> true
  29. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  30. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1<<my>>(10); //=> 12
  31. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  32. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  33. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  34. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  35. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  36. function My(a) { this.a = a; } My.prototype = {

    m1: function(b) { return this.a + b; } }; var my = new My(1); my.a; //=> 1 my.a = 2; my.m1(10); //=> 12
  37. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  38. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  39. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  40. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  41. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  42. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  43. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  44. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  45. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  46. function sum(a, b) { return a + b; } var

    left = 1; //.... var right = 2; sum(left, right);
  47. function left(a) { return function(b) { return a + b;

    }; } var right = left(1); //..... right(2);
  48. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  49. var a = 1; function func(refA) { var a =

    10; return refA(); }; func(function() { return a; });
  50. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  51. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  52. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  53. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  54. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  55. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  56. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  57. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  58. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  59. var a = 1; function func() { var a =

    10; return function() { return a++; }; } var b = func(); b(); //=> 10 b(); //=> 11 var c = func(); c(); //=> 10
  60. var a = 1; function func() { var a =

    10; return new Function("", "return a++;") } var b = func(); b();
  61. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  62. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  63. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  64. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  65. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });
  66. var a = 1; function func(refA) { var a =

    10; return refA(); } func(function() { return a; });