- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainApp.js
More file actions
Latest commit
34 lines (29 loc) · 828 Bytes
/
Copy pathmainApp.js
File metadata and controls
34 lines (29 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
constlist=document.querySelector('.list');
fetch("./projects.json")
.then(response=>{
returnresponse.json();
})
.then(data=>{
updateUI(data);
});
functionupdateUI(projects){
projects.forEach(({name, code, index})=>{
constlistItem=document.createElement('li');
listItem.innerHTML=`
<span class="project-number">${index}</span>
<a href="/${name}/index.html" class="project-name">
${projectNameFormater(name)}
</a>
<a href=${code} class="container-links">
Code
</a>
`;
list.appendChild(listItem);
});
}
functionprojectNameFormater(name){
returnname
.split('-')
.map(word=>word[0].toUpperCase()+word.slice(1))
.join(' ');
}