15.2.3.14-3-4.js (1145B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es5id: 15.2.3.14-3-4 6 description: > 7 Object.keys of an arguments object returns the indices of the 8 given arguments 9 ---*/ 10 11 function testArgs2(x, y, z) { 12 // Properties of the arguments object are enumerable. 13 var a = Object.keys(arguments); 14 if (a.length === 2 && a[0] in arguments && a[1] in arguments) 15 return true; 16 } 17 18 function testArgs3(x, y, z) { 19 // Properties of the arguments object are enumerable. 20 var a = Object.keys(arguments); 21 if (a.length === 3 && a[0] in arguments && a[1] in arguments && a[2] in arguments) 22 return true; 23 } 24 25 function testArgs4(x, y, z) { 26 // Properties of the arguments object are enumerable. 27 var a = Object.keys(arguments); 28 if (a.length === 4 && a[0] in arguments && a[1] in arguments && a[2] in arguments && a[3] in arguments) 29 return true; 30 } 31 32 assert(testArgs2(1, 2), 'testArgs2(1, 2) !== true'); 33 assert(testArgs3(1, 2, 3), 'testArgs3(1, 2, 3) !== true'); 34 assert(testArgs4(1, 2, 3, 4), 'testArgs4(1, 2, 3, 4) !== true'); 35 36 reportCompare(0, 0);