Skip to content

Instantly share code, notes, and snippets.

@m-yahya
Created April 28, 2021 15:21
Show Gist options
  • Save m-yahya/26b479aae46c3d8b0115f1d668afa9cb to your computer and use it in GitHub Desktop.
Save m-yahya/26b479aae46c3d8b0115f1d668afa9cb to your computer and use it in GitHub Desktop.
Tutorial: Nested UI from JSON data and Tree view
// get details
const getDetails = (details) => {
// iterate over the detail items of object
for (const detail in details) {
// fetch the value of each item
if (detail == "img") {
markupArray.push(
`<img src="./img/${details[detail]}" alt="${details[detail]}">`
);
} else {
markupArray.push(`<span> ${details[detail]} </span>`);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment