JSON

实用的javascript小技巧(2)

字号+ 作者:H5之家 来源:H5之家 2016-01-25 19:05 我要评论( )

if (!module.parent) { // ran with `node something.js` app.listen(8088, function() {console.log('app listening on port 8088'); })} else { // used with `require('/.something.js')` module.exports = app;

if (!module.parent) { // ran with `node something.js` app.listen(8088, function() { console.log('app listening on port 8088'); })} else { // used with `require('/.something.js')` module.exports = app;}

查看 了解更多。

本文的内容部分翻译自: https://github.com/loverajoel/jstips ,一个分享js技巧的仓库,每日更新,感兴趣的自行关注。

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
网友点评