1
2
3
4
5 function createMenuItem(name) {
6 let li = document.createElement('li');
7 li.textContent = name;
8 return li;
9}
10// get the ul#menu
11const menu = document.querySelector('#menu');
12// add menu item
13menu.appendChild(createMenuItem('Home'));
14menu.appendChild(createMenuItem('Services'));
15menu.appendChild(createMenuItem('About Us'));
16