h3xc0ntr0l
h3xc0ntr0l

Reputation: 399

Why doesn't this if/else work in ejs?

<% if (title != undefined) { %>
    <%= title %>
<% } elseif(title == undefined) { %>
    <%= "Trendy Analytics" %>
<% } %>

Why doesn't this sort of thing work in an .ejs file?

Upvotes: 2

Views: 3130

Answers (1)

mscdex
mscdex

Reputation: 106696

It's else if not elseif:

<% if (title != undefined) { %>
    <%= title %>
<% } else if(title == undefined) { %>
    <%= "Trendy Analytics" %>
<% } %>

Upvotes: 4

Related Questions