I have a javascript variable that is a consolidation of many different lines of text (html markup). See below. the info from the image property of the data object I'm injecting into this function may or may not be blank. So, I want a basic if statement to check if it is blank and output some other text if it is.
function(data) {
var div = [
<a href="/profile/'+data.message.name+'">',
if (data.message.image == "") {
// Some other string
}
<img src="/images/profiles/'+data.message.image+'" alt="#"/>',
</a>',
].join('');
}
Is it possible to nest an If statement in a variable like this? If so, what's the proper syntax?
Thanks!