11.this.js 734 B

123456789101112131415161718192021
  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. function write(v) { WScript.Echo(v + ""); }
  6. function f() {
  7. write("this : " + this);
  8. write("typeof(this) : " + typeof (this));
  9. eval('write("this : " + this);');
  10. eval('write("typeof(this) : " + typeof (this));');
  11. }
  12. f();
  13. f.call();
  14. f.call(undefined);
  15. f.call(null);
  16. f.call(this);
  17. f.call(10);
  18. f.call(new Number(10));