'locals' object in node js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

'locals' object in node js

i used res.render('/path', {prop: value}) in one file then i have to check if the variable exist in other file why should i use locals.prop name instead of property directly when I'm using the only property later.

24th Sep 2020, 2:52 PM
Utkarsh Dhiman
Utkarsh Dhiman - avatar
1 Answer
0
I guess you are probably using a templating engine like ejs, as ejs exposes the variables passed down from your backend using the locals object, see ejs documentation for more answers on your question
19th Oct 2020, 1:56 AM
bxhd