Skip to content

Instantly share code, notes, and snippets.

@alexkahn
Created November 24, 2015 21:23
Show Gist options
  • Save alexkahn/1cd93649d9db21b80570 to your computer and use it in GitHub Desktop.
Save alexkahn/1cd93649d9db21b80570 to your computer and use it in GitHub Desktop.
DRYing up the Code
var hoursLocations = [{
'days': 'mondays',
'times': '11AM - 3PM',
'location': 'City Hall Plaza - Fisher Park'
},
{
'days': 'TUESDAYS & THURSDAYS',
'times': "11AM - 3PM",
'location': "South End - Harrison Avenue and East Concord Street by BMC"
},
{
'days': 'WEDNESDAYS & FRIDAYS',
'times': "11AM - 3PM",
'location': "Back Bay - Trinity Place"
},
{
'days': 'SATURDAYS',
'times': "11AM - 3PM",
'location': "Dudley Square at Dudley Street"
}];
var elements = hoursLocations.map(function(item){
return "<div style='font-family: LiSong Pro;'><h1>" +
item.days + "</h1><p style='font-size: 1.25em;'>" +
item.times + "</p><p style ='font-size: 1.5em;'>" +
item.location + "<br /></p></div>";
});
var content1 = "<div style='font-family: LiSong Pro;'>" + "<h1>MONDAYS</h1>" + "<p style='font-size: 1.25em;'>" + "11AM - 3PM" + "</p>" + "<p style ='font-size: 1.5em;'>" + "City Hall Plaza - Fisher Park" + "<br />" + "</p></div>";
var content2 = "<div style='font-family: LiSong Pro;'>" + "<h1>TUESDAYS & THURSDAYS</h1>" + "<p style='font-size: 1.25em;'>" + "11AM - 3PM" + "</p>" + "<p style='font-size: 1.5em;'>" + "South End - Harrison Avenue and East Concord Street by BMC" + "<br />" + "</p></div>";
var content3 = "<div style='font-family: LiSong Pro;'>" + "<h1>WEDNESDAYS & FRIDAYS</h1>" + "<p style='font-size: 1.25em;'>" + "11AM - 3PM" + "</p>" + "<p style='font-size: 1.5em;'>" + "Back Bay - Trinity Place" + "<br />" + "</p></div>";
var content4 = "<div style='font-family: LiSong Pro;'>" + "<h1>SATURDAYS</h1>" + "<p style='font-size: 1.25em;'>" + "11AM - 3PM" + "</p>" + "<p style='font-size: 1.5em;'>" + "Dudley Square at Dudley Street" + "<br />" + "</p></div>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment