mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-13 22:00:19 -04:00
1.9 KiB
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;