zoukankan      html  css  js  c++  java
  • node 命令中 & 和 && 的区别

    node first.js & node second.js 

    执行结果: 
    第一次:

      first.js
      second.js

    第二次:

      second.js
      first.js

    第三次:

      first.js
      second.js

    第N次:

      ……

    总结: 使用 & 连接符, first.js 和 second.js 的执行顺序不确定

    node first.js && node second.js    

    执行结果: 
    第一次:

      first.js
      second.js

    第二次:

      first.js
      second.js

    第三次:

      first.js
      second.js

    第N次:

      ……

    总结: 使用 & 连接符, first.js 和 second.js 的执行顺序与命令中指定的先后顺序相同

    first.js

    1 function first(){
    2     console.log('first.js');
    3 }
    4 
    5 module.exports = first();

    second.js

    1 function second(){
    2     console.log('second.js');
    3 }
    4 
    5 module.exports = second();

    package.json

     1 {
     2     "name": "logicaloperators",
     3     "version": "1.0.0",
     4     "description": "",
     5     "main": "index.js",
     6     "scripts": {
     7         "and": "node first.js & node second.js",
     8         "andand": "node first.js && node second.js"
     9     },
    10     "author": "",
    11     "license": "ISC"
    12 }
  • 相关阅读:
    (转)剖析Delphi中的构造和析构
    求排列组合
    用链表写的猴子选大王
    查找文件
    在Delphi程序中应用IE浏览器控件
    汉字转UNICODE?
    webbrowser去掉边框
    自己写的猴子选大王
    数据库IDE查询实例
    Compiz Check测试Linux桌面3D兼容性
  • 原文地址:https://www.cnblogs.com/skating/p/7515572.html
Copyright © 2011-2022 走看看