baocaifeng / quantity

learning notes
0 stars 0 forks source link

CallBack #5

Open baocaifeng opened 6 years ago

baocaifeng commented 6 years ago

1) In node application, any async function accepts a callback as the last parameter and a callback function accepts an error as the first parameter

baocaifeng commented 6 years ago

2) mongod --dbpath /path/to/database

mongod --dbpath /path --port num

baocaifeng commented 6 years ago

3)assert

when writing a code we write tests to automatically check our code is working as we expect it to. assert is the most rudimentary way to write tests. it provides no feedback when running your code except one fails.

baocaifeng commented 6 years ago

4) return & if....else

return 用于提前结束流程,如果是多重回调,return比if----else更加明显 callback回调函数的参数列表可以自己定义,如果使用第三方库,参考具体的API文档怎么规定的