The same way you would do it with anything in js, typeof foo == 'undefined'
, or since “locals” is the name of the object containing them, you can do if (locals.foo)
. It’s just raw js :p
More Related Contents:
- Render a variable as HTML in EJS
- How to create global variables accessible in all views using Express / Node.JS?
- Passing an object to client in node/express + ejs?
- Displaying an image with EJS in node.js/express
- Unable to delete data from mongoDB
- collection is not defined in mongodb
- Express.js req.body undefined
- Cannot overwrite model once compiled Mongoose
- ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client
- How to separate routes on Node.js and Express 4?
- How to get all registered routes in Express?
- Purpose of installing Twitter Bootstrap through npm?
- TypeError: db.collection is not a function
- Error: No default engine was specified and no extension was provided
- Express command not found
- node.js http.get hangs after 5 requests to remote site
- Express res.sendfile throwing forbidden error
- Express doesn’t set a cookie
- ExpressJS & Websocket & session sharing
- How to setup an authentication middleware in Express.js
- How to server specifc static files with express.js
- Differences between express.Router and app.get?
- Error message “ENOENT, no such file or directory”
- Angularjs $http does not seem to understand “Set-Cookie” in the response
- Difference between `npm start` & `node app.js`, when starting app?
- Get route definition in middleware
- Express Router undefined params with router.use when split across files
- Connect or Express middleware to modify the response.body [closed]
- CORS-enabled server not denying requests
- Using multiple parameters in URL in express