Object.keys()
وتمريرها في كائن كوسيطة. سيؤدي هذا إلى إرجاع صفيف يحتوي على سلاسل تمثل كل خاصية في الكائن. مرة أخرى ، لن يكون هناك طلب محدد للإدخالات في الصفيف. getArrayOfUsers
كتابة الدالة getArrayOfUsers
بحيث تقوم بإرجاع صفيف يحتوي على كافة الخصائص في الكائن يتلقاها كوسيطة. users
فقط على مفاتيح Alan
و Jeff
و Sarah
و Ryan
testString: 'assert("Alan" in users && "Jeff" in users && "Sarah" in users && "Ryan" in users && Object.keys(users).length === 4, "The users
object only contains the keys Alan
, Jeff
, Sarah
, and Ryan
");'
- text: ترجع الدالة getArrayOfUsers
صفيف يحتوي على كافة المفاتيح الموجودة في كائن users
testString: 'assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf("Alan") !== -1 && R.indexOf("Jeff") !== -1 && R.indexOf("Sarah") !== -1 && R.indexOf("Ryan") !== -1 && R.indexOf("Sam") !== -1 && R.indexOf("Lewis") !== -1); })() === true, "The getArrayOfUsers
function returns an array which contains all the keys in the users
object");'
```