ejs how to get var in js script code example
Example 1: using server passed values and client js together in ejs
<% var test = 101; %> // variable created by ejs
<script>
var getTest = <%= test %>; //var test is now assigned to getTest which will only work on browsers
console.log(getTest); // successfully prints 101 on browser
</script>
Example 2: if you run a script.js with the code, how do you access the value passed to "var" inside script.js ...
if you run a script.js with the code, how do you access the value passed to "var" inside script.js VAR=value node script.js