Pass a variable from javascript to ejs
I want to use a variable which is declared in javascript file to a ejs file. javascript: var express = require('express'); var app = express(); var myVar = 1; In the ejs file , where I want to use that variable inside a few if statements ,I have to declare it again in order to be able to use it. ejs file: var myVar = 1; if ( my Var ) .... How can I avoid this?Or is there a way for creating a configuration file which is accesible from both javascript and ejs? I tried also to use: app.locals.myVar = 1 but it is undefined in the ejs file. ------- UPDATE -------------------------- In my code I am