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 }
  • 相关阅读:
    StringBuffer与Stringbuilder
    String与其他类型的转换
    创建多进程的方法
    8.进程
    克隆虚拟机
    初探12306售票算法(二)-java代码实践
    初探12306售票算法(一)- 理论
    手机上mcd程序耗电异常问题相关
    vue版app上下拉加载
    css基础
  • 原文地址:https://www.cnblogs.com/skating/p/7515572.html
Copyright © 2011-2022 走看看