Skip to content

Instantly share code, notes, and snippets.

@kypflug
Created May 11, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kypflug/bd0e1e04f2a9c0188c63c86278075a9a to your computer and use it in GitHub Desktop.
Save kypflug/bd0e1e04f2a9c0188c63c86278075a9a to your computer and use it in GitHub Desktop.
Top-down analysis sample code
// Create the hash tags for the blog articles and format them to fill the sidebar
var initializeHashtags = function () {
'use strict';
// Add all of the hash tags to the document
for (var i = 0; i < getNumTags(); i++) {
// create a div for each tag
var tag = document.createElement('div');
// Give the tag an id and class
tag.id = 'tag-' + i;
tag.classList.add('tag');
// Give it some random hashtag text
tag.innerHTML = '<p>' + randomText() + '</p>';
// Add the tag to the sidebar
document.getElementById(TAGS_DIV).appendChild(tag);
// After all of the tags are added, set the width for all of them
setWidthOfCells(TAGS_DIV);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment