arguments.js 678 B

12345678910111213141516
  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. let set = false;
  6. let a = JSON.parse('["first", null]', function (key, value) {
  7. if(!set) {
  8. this[1] = arguments;
  9. set = true;
  10. }
  11. return value;
  12. });
  13. let passed = JSON.stringify(a) === `["first",{"0":"0","1":"first"}]`;
  14. print(passed ? "Pass" : "Fail")