Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I prefer something like this before building the template string.

image = post.image_urls?[0] || "";

Then have the printImage function return an empty string if the argument is an empty string.

${printImage(image)}

Easier on the eyes.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: