Answers for "how to combine two array"

C#
52

combine two arrays javascript

let arr1 = [0, 1, 2];
let arr2 = [3, 5, 7];
let primes = arr1.concat(arr2);

// > [0, 1, 2, 3, 5, 7]
Posted by: Guest on February-02-2020
1

Concatenate two arrays

Array -- Concatenate two arrays
Write a return method that can concatenate two arrays
 
Solution:
public static int[] concatTwoArrays(int[] arr1 , int[] arr2) {
    int[] result = new int[arr1.length + arr2.length];
    int i = 0;
    for(int each: arr1) {
    result[i] = each;
    i++;
    }  
    for(int each: arr2) {
    result[i] =each;
    i++;
    }
    return result;
    }
Posted by: Guest on September-29-2021
1

js combine two arrays

const letters = ['a', 'b', 'c'];
const numbers = [1, 2, 3];

letters.concat(numbers);
// result in ['a', 'b', 'c', 1, 2, 3]
Posted by: Guest on September-24-2020
0

how to concatenate two arrays

var z = new int[x.Length + y.Length];
x.CopyTo(z, 0);
y.CopyTo(z, x.Length);
Posted by: Guest on June-14-2021

Code answers related to "how to combine two array"

C# Answers by Framework

Browse Popular Code Answers by Language