freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../basic-javascript/comparison-with-the-strict-...

2.7 KiB

id title challengeType videoUrl localeTitle
56533eb9ac21ba0edf2244d3 Comparison with the Strict Inequality Operator 1 مقارنة مع مشغل عدم المساواة الصارم

Description

إن عامل عدم المساواة الصارم ( !== ) هو المقابل المنطقي للمشغل الصارم للمساواة. ويعني "عدم التساوي في الدقة" ويعود false حيث تعود المساواة الصارمة إلى true والعكس صحيح . عدم المساواة الصارمة لن تقوم بتحويل أنواع البيانات. أمثلة
3! == 3 // false
3! == '3' // true
4! == 3 // صحيح

Instructions

إضافة strict inequality operator إلى العبارة if بحيث تقوم الدالة بإرجاع "غير مساوي" عندما لا يكون val مساوياً تمامًا لـ 17

Tests

tests:
  - text: <code>testStrictNotEqual(17)</code> إرجاع &quot;مساواة&quot;
    testString: 'assert(testStrictNotEqual(17) === "Equal", "<code>testStrictNotEqual(17)</code> should return "Equal"");'
  - text: <code>testStrictNotEqual(&quot;17&quot;)</code> &quot;غير مساوي&quot;
    testString: 'assert(testStrictNotEqual("17") === "Not Equal", "<code>testStrictNotEqual("17")</code> should return "Not Equal"");'
  - text: يجب أن <code>testStrictNotEqual(12)</code> &quot;غير مساوي&quot;
    testString: 'assert(testStrictNotEqual(12) === "Not Equal", "<code>testStrictNotEqual(12)</code> should return "Not Equal"");'
  - text: <code>testStrictNotEqual(&quot;bob&quot;)</code> &quot;غير مساوي&quot;
    testString: 'assert(testStrictNotEqual("bob") === "Not Equal", "<code>testStrictNotEqual("bob")</code> should return "Not Equal"");'
  - text: يجب عليك استخدام <code>!==</code> المشغل
    testString: 'assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, "You should use the <code>!==</code> operator");'

Challenge Seed

// Setup
function testStrictNotEqual(val) {
  // Only Change Code Below this Line

  if (val) {

  // Only Change Code Above this Line

    return "Not Equal";
  }
  return "Equal";
}

// Change this value to test
testStrictNotEqual(10);

Solution

// solution required