
CONCAT function is used for merging two or more array or you can push value into array by using CONCAT in JavaScript.
Syntax: var1.concat(var2)
Let me show here some examples for CONCAT function.
Example 1:
var a1 = [“a”,”b”,”c”];
var a2 = [“d”,”e”,”f”];
var c = a1.concat(a2);
console.log(c); // [“a”,”b”,”c”,“d”,”e”,”f”]
Example 2:
var a1 = [1,2,3];
var a2 = [4,5,6];
var c = a1.concat(a2);
console.log(c); // [1,2,3,4,5,6]
You can also merge one or more array as same like above example let me show you one more example-
var a1 = [1,2,3];
var a2 = [4,5,6];
var a3 = [7,8,9];
var c = a1.concat(a2,a3);
console.log(c); // [1,2,3,4,5,6,7,8,9]
Example 3: Use of CONCAT function you can push single value into array
var a1 = [1,2,3];
var c = a1.concat(4,5);
console.log(c); // [1,2,3,4,5]
Example 4: Use of CONCAT function you can merge and push single value into array
var a1 = [1,2,3];
var a2 = [4,5,6];
var c = a1.concat(a2,8);
console.log(c); // [1,2,3,4,5,6,8]
Awesome post! Keep up the great work! 🙂
Great content! Super high-quality! Keep it up! 🙂
PHP. I have always disliked the idea because of
Hello, you used to write great, but the last few posts have been kinda boring¡K I miss your great writings. Past few posts are just a little out of track! come on!
Hello. And Bye.
I dugg some of you post as I cerebrated they were very beneficial very useful
You could be my last best hope people :-/
I consider, that you are not right. I am assured. Let’s discuss it.
x-parser.gq
Hello guys. And Bye. 😉
economic crisis in pakistan essay 2020
Hello. And Bye.
Hello. And Bye.