<header>
<h2 class="title">З'єднання масивів</h2>
<p class="description">Приклад використання методу concat() для з'єднання масивів</p>
</header>
<main>
<pre>
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
</pre>
<div id="output"></div>
</main>
body {
font-size: 16px;
line-height: 1.5;
font-family: monospace;
}
pre {
color: #ff0000;
}
header {
background-color: #f1f1f1;
margin-bottom: 25px;
padding: 15px;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
header h2.title {
padding-bottom: 15px;
border-bottom: 1px solid #999;
}
header p.description {
font-style: italic;
color: #222;
}
#output {
margin-bottom: 10px;
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 4px;
}
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
document.getElementById("output").innerHTML = `Результат роботи методу (змінна <strong>array3</strong>): ${array3}`;
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.