Created
May 30, 2017 03:34
-
-
Save ginsterbusch/bf515f534556c1a45a3fcf207d73c272 to your computer and use it in GitHub Desktop.
Improved example function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BlogPost(postData) { | |
var class = 'sponsored-post', | |
checked = 'checked="checked"', | |
title = '<img src="/my/path/badge.png" />'; | |
if( !postData.isSponsored ) { | |
class = checked = title = ''; | |
} | |
return '<div class="post ${class}">' + | |
'<input type="checkbox" ${checked}>' + | |
'<h1>' + '${postData.title} ${title}' + '</h1>' + | |
'<h3>By ${postData.author}</h3>' + | |
'<p>${postData.body}</p>' + | |
'</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment