search

Home  >  Q&A  >  body text

node.js - nodejs如何做一个计数器?

nodejs 中如何做一个计数器,当我新增一条记录的时候,计数器加1
我遇到的问题是,我新增的代码是写在异步里面的,所以在外边访问的计数器总是0,请教各位大神,本人是新手,谢谢!

ringa_leeringa_lee2871 days ago616

reply all(1)I'll reply

  • 阿神

    阿神2017-04-17 16:17:10

    Change from asynchronous to synchronous, use promise or generator or async

    reply
    0
  • Cancelreply