回调地狱是回调函数多层嵌套导致代码难以维护的问题。 基于回调函数的异步编程一不小心就会产生回调地狱的问题。 const fs = require(“fs”) fs.readFile(“./x.txt”, “utf-8”, function (error, x) { fs.readFile(“./y.txt”, “utf-8”, function (error, y) { fs.readFile(“./z.txt”, “utf-8”, function (error, z) { console.log(x) console.log(y) console.log(z) }) }) }) const x = fs.readFile(‘./x.txt’, ‘utf-8’) const y = fs.readFile(‘./y.txt’, ‘utf-8’) const z = fs.readFile(‘./z.txt’, ‘utf-8’) console.log(x) console.log(y) console.log(z)