--- id: 56533eb9ac21ba0edf2244d8 title: Comparisons with the Logical And Operator challengeType: 1 videoUrl: '' localeTitle: مقارنات مع المنطقية والمشغل --- ## Description
في بعض الأحيان ستحتاج إلى اختبار أكثر من شيء واحد في كل مرة. إرجاع المنطقية والمشغل ( && ) true إذا وفقط إذا كانت المعاملات إلى اليسار واليمين صحيحاً. يمكن تحقيق نفس التأثير بتضمين جملة if داخل أخرى إذا:
if (num> 5) {
إذا (عدد <10) {
العودة "نعم" ؛
}
}
العودة "لا" ؛
سيعود فقط "نعم" إذا num أكبر من 5 وأقل من 10 . نفس المنطق يمكن كتابته على النحو التالي:
if (num> 5 & num <10) {
العودة "نعم" ؛
}
العودة "لا" ؛
## Instructions
قم بدمج العبارة "if" في عبارة واحدة والتي ستُرجع "Yes" إذا كان val أقل من أو يساوي 50 وأكبر من أو يساوي 25 . خلاف ذلك ، سيعود "No" .
## Tests
```yml tests: - text: يجب عليك استخدام مشغل && مرة واحدة testString: 'assert(code.match(/&&/g).length === 1, "You should use the && operator once");' - text: يجب أن يكون لديك واحد فقط if البيان testString: 'assert(code.match(/if/g).length === 1, "You should only have one if statement");' - text: يجب أن ترجع testLogicalAnd(0) "لا" testString: 'assert(testLogicalAnd(0) === "No", "testLogicalAnd(0) should return "No"");' - text: testLogicalAnd(24) يجب أن ترجع "لا" testString: 'assert(testLogicalAnd(24) === "No", "testLogicalAnd(24) should return "No"");' - text: testLogicalAnd(25) يجب أن ترجع "Yes" testString: 'assert(testLogicalAnd(25) === "Yes", "testLogicalAnd(25) should return "Yes"");' - text: يجب أن ترجع testLogicalAnd(30) "نعم" testString: 'assert(testLogicalAnd(30) === "Yes", "testLogicalAnd(30) should return "Yes"");' - text: يجب أن ترجع testLogicalAnd(50) "نعم" testString: 'assert(testLogicalAnd(50) === "Yes", "testLogicalAnd(50) should return "Yes"");' - text: testLogicalAnd(51) يجب أن ترجع "لا" testString: 'assert(testLogicalAnd(51) === "No", "testLogicalAnd(51) should return "No"");' - text: يجب أن testLogicalAnd(75) "لا" testString: 'assert(testLogicalAnd(75) === "No", "testLogicalAnd(75) should return "No"");' - text: testLogicalAnd(80) يجب أن ترجع "لا" testString: 'assert(testLogicalAnd(80) === "No", "testLogicalAnd(80) should return "No"");' ```
## Challenge Seed
```js function testLogicalAnd(val) { // Only change code below this line if (val) { if (val) { return "Yes"; } } // Only change code above this line return "No"; } // Change this value to test testLogicalAnd(10); ```
## Solution
```js // solution required ```