See the below snippets:
Snippet #1:
let fs = require("fs");
fs.readFile(process.argv[2], "utf8", (error, data) => console.log(arguments));
Snippet #2:
let fs = require("fs");
fs.readFile(process.argv[2], "utf8", (error, data) => console.log(error, data));
Expected log:
Values of (error, data)
, for example like:
null 'console.log("HELLO WORLD");\r\n'
When you try both these snippets, you will find that the Snippet #1 executes and logs some unexpected values for console.log(arguments)
but console.log(error, data)
logs proper values; values of (error, data)
.
Why and What was the value that is being logged for Snippet #1?