I use Webstorm as javascript ide and i have set an environment variable via configuration;
var pass = process.env.pass;
//console.log(pass);
if (userName == 'admin' && password == pass) {
//do something
}
If i run the script file it works fine without any problem and i can see the password in console, but when i run the index.html page, it does not load the page properly and when i delete var pass = process.env.pass;
and use a hardcoded password, it loads the page without any problem.
I'm new to javascript and am i doing something wrong here?
process.env
is Node.js construct. index.html
is static webpage displayed in browser, hence there is no notion of environment variables.
How are you using javascript code? As a Node module or as browser script?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.