enum.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var i;
  6. Object.prototype.u ="o.p.u";
  7. Object.prototype.x ="o.p.x";
  8. Object.prototype.y = "o.p.y";
  9. Object.prototype.z = "o.p.z";
  10. var f1 = function(){};
  11. f1.prototype.x = "f.p.x";
  12. f1.prototype.q = "f.p.q";
  13. f1.prototype.z = "f.p.z";
  14. f1.prototype.r = "f.p.r";
  15. var a1 = new f1();
  16. a1.x = "a.x";
  17. a1.q = "a.q";
  18. a1.u = "a.q";
  19. for (i in a1)
  20. {
  21. WScript.Echo(i+":"+a1[i]);
  22. }
  23. var a = new Object();
  24. a.x="hello";
  25. a.y="world";
  26. var o = new foo();
  27. o.pqr = "pqr";
  28. WScript.Echo("Object a");
  29. for (i in a)
  30. {
  31. WScript.Echo(i);
  32. }
  33. WScript.Echo("Math");
  34. for (i in Math)
  35. {
  36. WScript.Echo(i);
  37. }
  38. WScript.Echo("Array");
  39. for (i in Array)
  40. {
  41. WScript.Echo(i);
  42. }
  43. WScript.Echo("Array.prototype");
  44. for (i in Array.prototype)
  45. {
  46. WScript.Echo(i);
  47. }
  48. WScript.Echo("Date");
  49. for (i in Date)
  50. {
  51. WScript.Echo(i);
  52. }
  53. WScript.Echo("Number");
  54. for (i in Number)
  55. {
  56. WScript.Echo(i);
  57. }
  58. WScript.Echo("String");
  59. for (i in String)
  60. {
  61. WScript.Echo(i);
  62. }
  63. WScript.Echo("Object.prototype");
  64. Object.prototype.z = "me too";
  65. for (i in Object.prototype)
  66. {
  67. WScript.Echo(i);
  68. }
  69. WScript.Echo("Object");
  70. for (i in Object)
  71. {
  72. WScript.Echo(i);
  73. }
  74. WScript.Echo("Array.prototype.sort");
  75. for(i in Array.prototype.sort)
  76. {
  77. WScript.Echo(i);
  78. }
  79. WScript.Echo("function foo");
  80. function foo()
  81. {
  82. this.xyz = "xyz";
  83. }
  84. for(i in foo)
  85. {
  86. WScript.Echo(i);
  87. }
  88. Array.prototype.sort.x = "hello"
  89. var o = Array.prototype.sort;
  90. for (i in Array.prototype.sort)
  91. {
  92. WScript.Echo(i);
  93. }
  94. WScript.Echo("me here");
  95. WScript.Echo("prototype chain");
  96. Object.prototype.x = 10;
  97. function f() { }
  98. function g() { }
  99. g.prototype = new f();
  100. y = new g();
  101. for (i in y) { WScript.Echo(i); }
  102. var aString = "StringType";
  103. String.prototype.zz = "s.p.zz";
  104. var bString = new String("StringObject");
  105. bString.xx = "bString.xx";
  106. bString.yy = "bString.yy";
  107. WScript.Echo("Literal String");
  108. for( i in aString) { WScript.Echo(i); }
  109. WScript.Echo("String Object");
  110. for( i in bString) { WScript.Echo(i); }
  111. function Person(){}
  112. Person.prototype[5]=20;
  113. var a = new Person();
  114. for (var i in a) { WScript.Echo(i); }
  115. Array.prototype[3] = 3;
  116. var a = new Array();
  117. for (var i in a) { WScript.Echo(i); }
  118. for ( i in null ) { WScript.Echo(i); }