2.1 KiB
2.1 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7dac367417b2b2512b74 | Use Dot Notation to Access the Properties of an Object | 1 | استخدم Dot Notation للوصول إلى خصائص كائن |
Description
object
به properties
، والآن سترى كيفية الوصول إلى قيم تلك properties
. إليك مثال على ذلك: دع بطة = {يتم استخدام الترقيم النقطي على اسم
الاسم: "Aflac" ،
numLegs: 2
}؛
console.log (duck.name)؛
// هذا يطبع "Aflac" إلى وحدة التحكم
object
، duck
، متبوعًا باسم property
، name
، للوصول إلى قيمة "Aflac". Instructions
properties
كائن dog
أدناه لوحدة التحكم الخاصة بك. Tests
tests:
- text: يجب عليك استخدام <code>console.log</code> لطباعة القيمة لخاصية <code>name</code> كائن <code>dog</code> .
testString: 'assert(/console.log\(.*dog\.name.*\)/g.test(code), "Your should use <code>console.log</code> to print the value for the <code>name</code> property of the <code>dog</code> object.");'
- text: يجب استخدامك <code>console.log</code> لطباعة القيمة لخاصية <code>numLegs</code> للكائن <code>dog</code> .
testString: 'assert(/console.log\(.*dog\.numLegs.*\)/g.test(code), "Your should use <code>console.log</code> to print the value for the <code>numLegs</code> property of the <code>dog</code> object.");'
Challenge Seed
let dog = {
name: "Spot",
numLegs: 4
};
// Add your code below this line
Solution
// solution required