File tree Expand file tree Collapse file tree
1-js/04-object-basics/01-object Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ importance: 5
22
33---
44
5- # Hello, object
5+ # أهلا ، كائن
66
7- Write the code, one line for each action:
8-
9- 1 . Create an empty object ` user ` .
10- 2 . Add the property ` name ` with the value ` John ` .
11- 3 . Add the property ` surname ` with the value ` Smith ` .
12- 4 . Change the value of the ` name ` to ` Pete ` .
13- 5 . Remove the property ` name ` from the object.
7+ اكتب الشفرة من سطر واحد لكل حدث من الأحدائ الآتية
148
9+ 1 . انشاء كائن ` user ` فارغ .
10+ 2 . اضافة خاصية ` name ` تكون قيمتها ` John `
11+ 3 . اضافة خاصية ` surname ` تكون قيمتها ` Smith `
12+ 4 . تغيير قيمة ` name ` الى ` Pete `
13+ 5 . ازالة الخاصية ` name ` من الكائن
Original file line number Diff line number Diff line change 1- Just loop over the object and ` return false` immediately if there's at least one property .
1+ ما عليك سوى التكرار فوق الكائن و "إرجاع false" على الفور إذا كان هناك خاصية واحدة على الأقل .
Original file line number Diff line number Diff line change @@ -2,19 +2,18 @@ importance: 5
22
33---
44
5- # Check for emptiness
5+ # تحقق من الفراغ
66
7- Write the function ` isEmpty(obj) ` which returns ` true ` if the object has no properties, ` false ` otherwise.
7+ اكتب دالة ` isEmpty(obj) و التى تقوم بارجاع ` true` اذا كان الكائن لا يحتوى على خواص و ارجاع ` false` فى الحالات الأخرى
88
9- Should work like that :
9+ يجب أن تعمل بهذا الشكل :
1010
1111``` js
1212let schedule = {};
1313
14- alert ( isEmpty (schedule) ); // true
14+ alert (isEmpty (schedule)); // true
1515
1616schedule[" 8:30" ] = " get up" ;
1717
18- alert ( isEmpty (schedule) ); // false
18+ alert (isEmpty (schedule)); // false
1919```
20-
Original file line number Diff line number Diff line change @@ -2,18 +2,18 @@ importance: 5
22
33---
44
5- # Sum object properties
5+ # جمع خصائص الكائن
66
7- We have an object storing salaries of our team :
7+ لدينا كائن يقوم بتخزين رواتب فريقنا :
88
99``` js
1010let salaries = {
1111 John: 100 ,
1212 Ann: 160 ,
1313 Pete: 130
14- }
14+ };
1515```
1616
17- Write the code to sum all salaries and store in the variable ` sum ` . Should be ` 390 ` in the example above .
17+ اكتب الرمز لتجميع جميع الرواتب وتخزينها في المتغير ` sum ` . يجب أن يكون ` 390 ` في المثال أعلاه .
1818
19- If ` salaries ` is empty, then the result must be ` 0 ` .
19+ إذا كانت ` salaries ` فارغة ، فيجب أن تكون النتيجة "0" .
Original file line number Diff line number Diff line change @@ -2,11 +2,13 @@ importance: 3
22
33---
44
5- # Multiply numeric properties by 2
5+ # ضرب الخصائص الرقمية في 2
66
7- Create a function ` multiplyNumeric(obj) ` that multiplies all numeric properties of ` obj ` by ` 2 ` .
7+ أنشئ دالة ` multiplyNumeric (obj) ` تضرب جميع الخصائص الرقمية لـ ` obj ` بـ ` 2 ` .
88
9- For instance:
9+ على سبيل المثال:
10+
11+ إذا كانت "الرواتب" فارغة ، فيجب أن تكون النتيجة "0".
1012
1113``` js
1214// before the call
@@ -26,8 +28,6 @@ menu = {
2628};
2729```
2830
29- Please note that ` multiplyNumeric ` does not need to return anything. It should modify the object in-place.
30-
31- P.S. Use ` typeof ` to check for a number here.
32-
31+ يرجى ملاحظة أن ` multiplyNumeric ` لا تحتاج إلى إرجاع أي شيء. يجب تعديل الكائن في مكانه.
3332
33+ ملاحظة. استخدم ` typeof ` للتحقق من وجود رقم هنا. s في 2
You can’t perform that action at this time.
0 commit comments