object
به properties
، والآن سترى كيفية الوصول إلى قيم تلك properties
. إليك مثال على ذلك: دع بطة = {يتم استخدام الترقيم النقطي على اسم
الاسم: "Aflac" ،
numLegs: 2
}؛
console.log (duck.name)؛
// هذا يطبع "Aflac" إلى وحدة التحكم
object
، duck
، متبوعًا باسم property
، name
، للوصول إلى قيمة "Aflac". properties
كائن dog
أدناه لوحدة التحكم الخاصة بك. console.log
لطباعة القيمة لخاصية name
كائن dog
.
testString: 'assert(/console.log\(.*dog\.name.*\)/g.test(code), "Your should use console.log
to print the value for the name
property of the dog
object.");'
- text: يجب استخدامك console.log
لطباعة القيمة لخاصية numLegs
للكائن dog
.
testString: 'assert(/console.log\(.*dog\.numLegs.*\)/g.test(code), "Your should use console.log
to print the value for the numLegs
property of the dog
object.");'
```