We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef2b009 commit 17af799Copy full SHA for 17af799
test/fixtures/bin/echo-args
@@ -7,6 +7,8 @@
7
*/
8
"use strict";
9
10
-process.argv.slice(2).forEach((arg, index) => {
+let args = process.argv.slice(2);
11
+
12
+for (let [index, arg] of args.entries()) {
13
console.log(`Argument #${index + 1}: ${arg}`);
-});
14
+}
test/fixtures/bin/echo-env
@@ -7,6 +7,13 @@
-process.argv.slice(2).forEach((arg) => {
- console.log(`${arg}: ${process.env[arg]}`);
+let variableNames = process.argv.slice(2);
+if (variableNames.length === 0) {
+ console.log("No environment variables were specified");
15
+else {
16
+ for (let name of variableNames) {
17
+ console.log(`${name}: ${process.env[name]}`);
18
+ }
19
0 commit comments