freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../basic-javascript/finding-a-remainder-in-java...

2.3 KiB

id title challengeType videoUrl localeTitle
56533eb9ac21ba0edf2244ae Finding a Remainder in JavaScript 1 العثور على البقية في جافا سكريبت

Description

يعطي عامل الباقي % الباقي من قسم رقمين. مثال
5٪ 2 = 1 بسبب
Math.floor (5/2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (البقية)
استعمال
في الرياضيات ، يمكن التحقق من الرقم ليكون زوجي أو فردي عن طريق فحص الجزء المتبقي من تقسيم الرقم إلى 2 .
17٪ 2 = 1 (17 فردي)
48٪ 2 = 0 (48 حتى)
ملحوظة
في بعض الأحيان يشار إلى مشغل الباقي بشكل غير صحيح باسم مشغل "المعامل". وهي تشبه إلى حد بعيد المعامل ، ولكنها لا تعمل بشكل صحيح مع الأرقام السالبة.

Instructions

حدد remainder مساويًا لما تبقى من 11 مقسومًا على 3 باستخدام عامل الباقي ( % ).

Tests

tests:
  - text: يجب تهيئة المتغير <code>remainder</code>
    testString: 'assert(/var\s+?remainder/.test(code), "The variable <code>remainder</code> should be initialized");'
  - text: يجب أن تكون قيمة <code>remainder</code> <code>2</code>
    testString: 'assert(remainder === 2, "The value of <code>remainder</code> should be <code>2</code>");'
  - text: يجب عليك استخدام عامل التشغيل <code>%</code>
    testString: 'assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code), "You should use the <code>%</code> operator");'

Challenge Seed

// Only change code below this line

var remainder;

After Test

console.info('after the test');

Solution

// solution required