Answers for "concat()"

50

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

concat

const array1 = [
  {
      "id": 2,
      "name": "Ijtimoiy hayot",
      "user_id": null,
      "color": "#230A75"
  },
  {
      "id": 3,
      "name": "O'z-o'zini rivojlantirish",
      "user_id": null,
      "color": "#64E9D8"
  }
  ];
const array2 = [
  {
      "id": 0,
      "name": "Boshqalar",
      "user_id": null,
      "color": "#95289A"
  },
  {
      "id": 1,
      "name": "Oziq - Ovqat",
      "user_id": null,
      "color": "#26a0fc"
  }
];
const array3 = array1.concat(array2);

console.log(array3);
// expected output: Array ["a", "b", "c", "d", "e", "f"]
Posted by: Guest on November-15-2021
4

concat

const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);

console.log(array3);
// expected output: Array ["a", "b", "c", "d", "e", "f"]
Posted by: Guest on November-15-2021
12

string concatenation in js

var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
console.log(res);
Posted by: Guest on April-28-2020
2

javascript string concat vs +

It is strongly recommended to use the string
concatenationoperators (+, +=) instead of String.concat
method for perfomance reasons
Posted by: Guest on May-23-2020
6

concat js mdn

const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);

console.log(array3);
// expected output: Array ["a", "b", "c", "d", "e", "f"]
Posted by: Guest on March-11-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language