0

I have the following which is working as intended:

<%= employee.title %>, Support Member

I am trying to add a conditional such as:

<% if(!employee.title.includes('Junior')){ %>
    employee.title
<% } %>
Support Member

However it seems that it no longer has access to "employee" as it prints out the literal "employee.title".

I have referred to this thread for syntax help but have had no luck. Does anyone spot my issue? I couldn't find documentation help online.

chevybow
  • 9,959
  • 6
  • 24
  • 39
  • 1
    you have also wrap it as `<%= employee.title %>` inside to tell your view engine here is an expression. – Leo Li Apr 23 '18 at 19:51

1 Answers1

1

You need to do:

<% if(!employee.title.includes('Junior')){ %>
  <%= employee.title %>
<% } %>
Support Member

Check Docs.

Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
  • Thanks! I actually was initially wrapping it but I think I accidentally wrapped `<%=` with `%>` which threw me off. – chevybow Apr 23 '18 at 19:58