freeCodeCamp/guide/arabic/certifications/javascript-algorithms-and-d.../functional-programming/combine-two-arrays-using-th.../index.md

740 B

title localeTitle
Combine Two Arrays Using the concat Method الجمع بين اثنين من المصفوفات باستخدام طريقة concat

الجمع بين اثنين من المصفوفات باستخدام طريقة concat

  • يتم استخدام الأسلوب concat لربط صفيفين أو أكثر أو سلاسل.
  • هذه الطريقة لا تحوِّل الصفائف الموجودة ، ولكنها تعيد صفيفًا جديدًا.

حل

`function nonMutatingConcat(original, attach) { // Add your code below this line

return original.concat(attach);

// Add your code above this line } var first = [1, 2, 3]; var second = [4, 5]; nonMutatingConcat(first, second); `