javascript node.js next()

后端 未结 3 582
日久生厌
日久生厌 2020-11-27 10:31

I see a lot of use next in node.js.

What is it, where does it come from? What does it do? Can I use it client side?

Sorry it\'s used for example

3条回答
  •  盖世英雄少女心
    2020-11-27 10:57

    It is naming convention used when passing callbacks in situations that require serial execution of actions, e.g. scan directory -> read file data -> do something with data. This is in preference to deeply nesting the callbacks. The first three sections of the following article on Tim Caswell's HowToNode blog give a good overview of this:

    http://howtonode.org/control-flow

    Also see the Sequential Actions section of the second part of that posting:

    http://howtonode.org/control-flow-part-ii

提交回复
热议问题