Categories
JavaScript Answers

How to check if a variable exists with Node Jade Template Engine?

Spread the love

To check if a variable exists with Node Jade Template Engine, we use an if statement.

For instance, we write

if locals.username
  p= username
else
  p No Username!

to check is the locals.username variable exists with if locals.username.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *