I’m sure I’m doing pretty simple wrong but can’t seem to find an explanation. I’ve got the following line in my template which is not printing any values to the html output:
<%= _.each(@place.get("hash"),(count, tag) -> "#{tag} ") %>
This line is printing values to the console perfectly fine:
<%= _.each(@place.get("hash"),(count, tag) -> console.log "#{tag} ") %>
When I try using a print command and refresh, google chrome throws up a print menu. How can I resolve this
Underscore’s
eachdoesn’t return anything so<%= _.each(...) %>doesn’t do anything useful. You could use_.mapandjoin:or you could use
_.keysandjoin:Your
_.eachis just extracting the keys so you should say what you mean.If you’re using node.s then you should have
Object.keysas well: