<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
ul li{
list-style: none;
border-style:groove;
border-radius: 40px;
}
ul li:hover{
background-color: red;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<h3>villes:</h3>
<textarea id="text"></textarea>
<br/>
<button id="submit" onclick="submit()">Submit</button>
</div>
<div class="guestList">
<div id="list"></div>
</div>
</div>
<script>
function submit(){
var guestName=document.getElementById('text');
var listData=guestName.value.split('
');
var listContainer=document.getElementById('list'),
listElement=document.createElement("ul");
listContainer.appendChild(listElement);
var numberOfListItems=listData.length;
var listItem;
for(var i=0; i<numberOfListItems; ++i){
listItem=document.createElement("li");
listItem.innerHTML=listData[i];
listElement.appendChild(listItem);
}
}
</script>
</body>
</html>
a.push(...b);
var a = [1,2,3];
var b = [4,5,6];
a.push(...b); // [1,2,3,4,5,6]
// The .push method can take multiple arguments.
// You can use the spread operator (...) to pass all
// the elements of the second array as arguments to .push