A promise is a placeholder for the result of an asynchronous operation.
The function can return a promise, like this:
let promise = readFile("example.txt");
readFile
promises to complete at some point in the future
In this code, readFile()
doesn't actually start reading the file immediately.
The read action will happen later.
The function returns a promise object representing the asynchronous read operation.
We can work with it in the future.