Solution
Solution
- Given previous object
- Standalone function
- Object as input
- key/value list
- Insert into DOM
Create function that takes an object as an input and creates a list in the DOM out of the Object's key/value pairs.
function listObject(data) {
const $ = document.querySelector.bind(document)
let output = '<ul>'
for (const key in data) {
output+=`<li><a href="${data[key]}">${key}</a></li>`
}
output +='</ul>'
$('#output').innerHTML = output
}