freeCodeCamp Challenge Guide: Use the .env File

Use the .env File


Problem Explanation

We can use the .toUpperCase() method to make a string all caps, such as:

var response = "Hello World".toUpperCase(); // now becomes "HELLO WORLD"

All we need to do now is check what the value of the environment variable is, which you can do like:

if (process.env.VAR_NAME === "allCaps") {
  response = "Hello World".toUpperCase();
} else {
  response = "Hello World";
}

NOTE: Ensure the fcc-express-bground package in your package.json file is pointing to this URL: https://github.com/freeCodeCamp/fcc-express-bground-pkg.git

2 Likes