Files
freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md
freeCodeCamp's Camper Bot 64697d4ca7 chore(i18n,learn): processed translations (#54988)
Co-authored-by: Naomi <commits@nhcarrigan.com>
2024-05-28 16:57:56 +09:00

1.9 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5ee127a03c3b35dd45426493 تعيين قيمة متغير إلى متغير آخر 1 418265 assigning-the-value-of-one-variable-to-another

--description--

بعد تعيين قيمة إلى متغير باستخدام مشغل التعيين (=)، يمكنك تعيين قيمة هذا المتغير إلى متغير آخر باستخدام مشغل التعيين (=) ذاتها.

var myVar;
myVar = 5;
var myNum;
myNum = myVar;

ما ورد أعلى يعلن المتغير myVar دون قيمة، ثم يخصص له قيمة 5. بعد ذلك، يتم إعلان متغير آخر يدعى myNum دون قيمة. ثم يتم تعيين قيمة المتغير myVar (التي تساوي 5) إلى المتغير myNum. الآن المتغير myNum لديه القيمة 5.

--instructions--

عيًن قيمة المتغيرa إلى المتغير b.

--hints--

لا يجب عليك تعديل التعليمات البرمجية فوق التعليق المحدد.

assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code)));

المتغير b يجب أن يساوي 7.

assert(typeof b === 'number' && b === 7);

قيمة المتغير a يجب أن يتم تعيينها إلى المتغير b باستخدام =.

assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code)));

--seed--

--before-user-code--

if (typeof a != 'undefined') {
  a = undefined;
}
if (typeof b != 'undefined') {
  b = undefined;
}

--after-user-code--

(function(a, b) {
  return 'a = ' + a + ', b = ' + b;
})(a, b);

--seed-contents--

// Setup
var a;
a = 7;
var b;

// Only change code below this line

--solutions--

var a;
a = 7;
var b;
b = a;