fix: converted single to triple backticks4 (#36231)

This commit is contained in:
Randell Dawson
2019-06-20 14:07:46 -07:00
committed by Tom
parent 0011f254c1
commit 926ddea5b0
75 changed files with 886 additions and 782 deletions

View File

@@ -20,10 +20,11 @@ localeTitle: استخدم Arrow Functions لكتابة الدالات المجه
## حل
`const magic = () => {
"use strict";
return new Date();
};
`
```javascript
const magic = () => {
"use strict";
return new Date();
};
```
طالما أنك تخلصت من الكلمة الرئيسية `var` ، فأنت جيد.

View File

@@ -18,18 +18,19 @@ localeTitle: استخدم بناء جملة class لتعريف دالة منشئ
## حل:
`function makeClass() {
"use strict";
/* Alter code below this line */
class Vegetable {
constructor(name){
this.name = name;
}
}
/* Alter code above this line */
return Vegetable;
}
`
```javascript
function makeClass() {
"use strict";
/* Alter code below this line */
class Vegetable {
constructor(name){
this.name = name;
}
}
/* Alter code above this line */
return Vegetable;
}
```
\=======

View File

@@ -12,5 +12,6 @@ localeTitle: استخدم Destructuring Assignment لتعيين متغيرات
هنا هو الحل رمز:
`const { tomorrow: { max: maxOfTomorrow } } = forecast;
`
```javascript
const { tomorrow: { max: maxOfTomorrow } } = forecast;
```

View File

@@ -12,10 +12,11 @@ localeTitle: استخدم Destructuring Assignment لتعيين متغيرات
# إعادة تعيين خصائص باستخدام deconstruction.
`var basicOjb = {x: 40};
//To reassign 'get the value of the x property of basicObj and place its value into bigX' in ES6:
const { x: bigX } = basicOjb;
consle.log(bigX) // ans = 40
`
```javascript
var basicOjb = {x: 40};
//To reassign 'get the value of the x property of basicObj and place its value into bigX' in ES6:
const { x: bigX } = basicOjb;
consle.log(bigX) // ans = 40
```
ضع قيمة الخاصية الطول 'str' في len.

View File

@@ -14,18 +14,19 @@ localeTitle: استخدم Destructuring Assignment لتمرير كائن كمع
## الحل 1:
`const half = (function() {
"use strict"; // do not change this line
// change code below this line
return function half({max, min}) {
// use function argument destructuring
return (max + min) / 2.0;
};
// change code above this line
})();
`
```javascript
const half = (function() {
"use strict"; // do not change this line
// change code below this line
return function half({max, min}) {
// use function argument destructuring
return (max + min) / 2.0;
};
// change code above this line
})();
```
لاحظ أننا ندمر `stats` لتمرير اثنين من صفاتها - `max` `min` - إلى الوظيفة. لا تنس تعديل بيان الإرجاع الثاني. تغيير `stats.max` إلى `max` ، وتغيير `stats.min` إلى `min` فقط.
@@ -33,15 +34,16 @@ localeTitle: استخدم Destructuring Assignment لتمرير كائن كمع
هنا هو حل آخر يعمل. ليس الكثير من الاختلاف ، بخلاف حقيقة أن الوظيفة لا تملك اسمًا.
`const half = (function() {
"use strict"; // do not change this line
// change code below this line
return (({max, min}) => {
// use function argument destructuring
return (max + min) / 2.0;
});
// change code above this line
})();
`
```javascript
const half = (function() {
"use strict"; // do not change this line
// change code below this line
return (({max, min}) => {
// use function argument destructuring
return (max + min) / 2.0;
});
// change code above this line
})();
```

View File

@@ -20,48 +20,52 @@ localeTitle: استخدم Destructuring Assignment مع عامل التشغيل
استخدم destructuring لإنشاء متغير `arr` .
`function removeFirstTwo(list) {
"use strict";
// change code below this line
const [arr] = list; // change this
// change code above this line
return arr;
}
`
```javascript
function removeFirstTwo(list) {
"use strict";
// change code below this line
const [arr] = list; // change this
// change code above this line
return arr;
}
```
## تلميح 2
انشر معلمة `list` في `arr` .
`function removeFirstTwo(list) {
"use strict";
// change code below this line
const [...arr] = list; // change this
// change code above this line
return arr;
}
`
```javascript
function removeFirstTwo(list) {
"use strict";
// change code below this line
const [...arr] = list; // change this
// change code above this line
return arr;
}
```
## تلميح 3
استبعاد أول عنصرين من صفيف `arr` مع `,,` .
`function removeFirstTwo(list) {
"use strict";
// change code below this line
const [,,...arr] = list; // change this
// change code above this line
return arr;
}
`
```javascript
function removeFirstTwo(list) {
"use strict";
// change code below this line
const [,,...arr] = list; // change this
// change code above this line
return arr;
}
```
## تنبيه المفسد - الحل إلى الأمام!
`function removeFirstTwo(list) {
"use strict";
// change code below this line
const [a, b, ...arr] = list;
// change code above this line
return arr;
}
`
```javascript
function removeFirstTwo(list) {
"use strict";
// change code below this line
const [a, b, ...arr] = list;
// change code above this line
return arr;
}
```

View File

@@ -16,7 +16,8 @@ localeTitle: استخدم التصدير لإعادة استخدام كتلة ت
## حل
`"use strict";
export const foo = "bar";
export const bar = "foo";
`
```javascript
"use strict";
export const foo = "bar";
export const bar = "foo";
```

View File

@@ -29,17 +29,20 @@ localeTitle: استخدم Spread Operator لتقييم Arrays في - مكان
### 3 أمثلة سريعة
`let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min.apply(null, numbers);
console.log(minNum);//-12
`
```javascript
let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min.apply(null, numbers);
console.log(minNum);//-12
```
`let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min(numbers);
console.log(minNum);//NaN
`
```javascript
let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min(numbers);
console.log(minNum);//NaN
```
`let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min(...numbers);
console.log(minNum);//-12
`
```javascript
let numbers = [-12, 160, 0, -3, 51];
let minNum = Math.min(...numbers);
console.log(minNum);//-12
```

View File

@@ -20,10 +20,11 @@ localeTitle: كتابة وظائف السهم مع المعلمات
## حل:
`const myConcat = (arr1, arr2) => {
"use strict";
return arr1.concat(arr2);
};
// test your code
console.log(myConcat([1, 2], [3, 4, 5]));
`
```javascript
const myConcat = (arr1, arr2) => {
"use strict";
return arr1.concat(arr2);
};
// test your code
console.log(myConcat([1, 2], [3, 4, 5]));
```

View File

@@ -14,11 +14,12 @@ ES6 يجعل من السهل ، والخيال ، لكتابة وظائف الإ
## حل
`const bicycle = {
gear: 2,
setGear(newGear) {
"use strict";
this.gear = newGear;
}
};
`
```javascript
const bicycle = {
gear: 2,
setGear(newGear) {
"use strict";
this.gear = newGear;
}
};
```

View File

@@ -14,14 +14,15 @@ localeTitle: كتابة تعريفات كائن حرفي باستخدام حقو
## حل
`const createPerson = (name, age, gender) => {
"use strict";
// change code below this line
return {
name,
age,
gender
};
// change code above this line
};
`
```javascript
const createPerson = (name, age, gender) => {
"use strict";
// change code below this line
return {
name,
age,
gender
};
// change code above this line
};
```