My serverside code in Node.JS (using Express) is as follows
res.render('index', {
startDateTime: startDateTime,
endDateTime: endDateTime
});
I'd like to access startDateTime and endDateTime on the clientside using Javascript. I know I can access them using Jade by doing #{startDateTime} . Is there a similar approach for Javascript?
If I understood your question right, you're wanting to send those variables to an external .js file. If that's the problem, I've answered it right here, but I'm quoting it here:
[...] Two ways of solving this problem that we use in my company are:
Take advantage of the
dataattributes of HTML5.
They're a great way to store some info, and jQuery can even retrieve them in the JS type you need!Use
<input type="hidden" />fields.