Skip to content

Instantly share code, notes, and snippets.

@shannonjen
Last active September 14, 2017 13:07
Show Gist options
  • Save shannonjen/0157d50ce320f98ab1f698421b7d62f8 to your computer and use it in GitHub Desktop.
Save shannonjen/0157d50ce320f98ab1f698421b7d62f8 to your computer and use it in GitHub Desktop.
// Define a function named createList that takes one argument.
// sites (object)
//
// The object has the following structure:
// {
// 'TITLE': 'URL',
// 'TITLE': 'URL',
// 'TITLE': 'URL',
// ...
// }
//
// The function must return an <ul> element that contains <li> elements that
// each contain an <a> element. For example, given:
// {
// 'Google': 'https://www.google.com',
// 'Facebook': 'https://www.facebook.com',
// 'GitHub': 'https://github.com',
// 'Galvanize': 'https://www.galvanize.com'
// }
//
// It returns the following:
// <ul>
// <li><a href="https://www.google.com">Google</a></li>
// <li><a href="https://www.facebook.com">Facebook</a></li>
// <li><a href="https://github.com">GitHub</a></li>
// <li><a href="https://www.galvanize.com">Galvanize</a></li>
// </ul>
//
// Clue: The function should use DOM methods/properties. You will be creating elements, setting attributes, and appending nodes.
// Ie, use createElement(), textContent, setAttribute(), appendChild(),...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment