Javascript: Javascript basics for Beginners by Vickler Andy

Javascript: Javascript basics for Beginners by Vickler Andy

Author:Vickler, Andy [Vickler, Andy]
Language: eng
Format: epub
Published: 2021-03-01T00:00:00+00:00


JavaScript Array concat()

The concat() method follows the merging pattern:

Tomato, Potato, Cauliflower, Cabbage, Orange, Fig, Guava, Date

The concat() method in JavaScript can be treated with more than two arguments. You can add another array to merge it up with the two. The following example will explain the method by which you can merge up to three arrays.

<!DOCTYPE html>

<html>

<body>

<p>JavaScript Array concat()</p>

<p>The concat() method follows the merging pattern:</p>

<p id="array-demo"></p>

<script>

var veggies = ["Tomato ", "Potato ", "Cauliflower ", "Cabbage "];

var frutoos = ["Orange ", "Fig ", "Guava ", "Date "];

var summerfrutoos = ["Watermelon ", "Melon ", "Mango "]

var fruitbasket = veggies.concat(frutoos, summerfrutoos);

document.getElementById("array-demo").innerHTML = fruitbasket;

</script>

</body>

</html>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.