JavaScript USES concat to concatenate arrays

  • 2020-05-26 07:48:59
  • OfStack

This example shows how JavaScript connects arrays using concat. Share with you for your reference. The details are as follows:

The following code demonstrates how to link multiple arrays in JS using the concat function

<!DOCTYPE html>
var parents = ["Jani", "Tove"];
var brothers = ["Stale", "Kai Jim", "Borge"];
var children = ["Cecilie", "Lone"];
var family = parents.concat(brothers, children);

The above code runs as follows:

Jani,Tove,Stale,Kai Jim,Borge,Cecilie,Lone

I hope this article is helpful for you to design javascript program.

Related articles: