Home>

The third argument of fs.readFile is called a callback function
It seems, but for this function,
It is necessary to pass two arguments, an error is given as the first argument, and the execution result is given as the second argument.
Is it decided as a language such as entering?
(What happens if you change the order of the arguments or specify only one?)

const fs = require ('fs')
fs.readFile ('a.txt','utf-8', function (err, data) {
    console (data)
})

As an understanding of callback functions
I think it's a function that is called when something is executed.
I don't understand how to specify arguments and rules.