如何在 google-apps-script 中修复此 "assignment"?

How do I fix this "assignment" in google-apps-script?

所以我开始编辑这段代码,这样我就可以让它创造文字。最终复制了 Alan Turing 的 Bombe。但是在我上次编辑后我的 "assignment" 变得无效了?现在我很困惑,特别是因为我不是 100% 熟悉 google-apps-script.

这是我当前的脚本当前所说的内容:

function bombeCode2() {

  var fastRotor = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
    "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
  ];

  var mediumRotor = fastRotor;
  var slowRotor = fastRotor;

  var rows = 26;
  var columns = 26;

  for (var i = 0; i < rows; i++) {
    Logger.log('Outer Loop: value of i : ' + i);
    // Logger.log("Partition for Outer Loop");
    // Logger.log(" ");
    var fastRotorValue = fastRotor[i];

    for (var j = 0; j < columns; j++) {
      Logger.log('-Inner Loop value of j : ' + j);
      //var fastRotorValue = fastRotor[i];
      var medRotorValue = mediumRotor[j];

      // Logger.log("---- " + fastRotorValue + " " + medRotorValue);

      for (var k = 0; k < 26; k++) {
        // Logger.log('---- XXXX Third Loop value of k : ' + k);
        //var fastRotorValue = fastRotor[i];
        //var medRotorValue = mediumRotor[j];
        var slowRotorValue = slowRotor[k];
        if ("---- XXXX " + fastRotorValue + " " + medRotorValue + " " + slowRotorValue = "WEATHER") {
          Logger.log("---- XXXX " + fastRotorValue + " " + medRotorValue + " " + slowRotorValue = "WEATHER")
        }
        // Logger.log("---- XXXX " + fastRotorValue + " " + medRotorValue + " " + slowRotorValue);
      };

      //var objectNumberValuePair = {"0":"A", "1":"B", "2":"C","3":"D","4":"E","5":"F","6":"G","7":"H","8":"I",
      //  "9":"J","10":"K","11":"L","12":"M","13":"N","14":"O","15":"P","16":"Q","17":"R",
      //  "18":"S","19":"T","20":"U","21":"V","22":"W","23":"X","24":"Y","25":"Z"}
      //  Logger.log(slowRotorValue = objectNumberValuePair); 
      //  Logger.log(medRoterValue = objectNumberValuePair);
      //  Logger.log(fastRoterValue = objectNumberValuePair);
    }

  }
}

是的,我知道一半是没用的。然而,这只是为了让我记住所有内容 is/does。 有谁知道如何解决这个问题 "assignment?" 这是它给我的错误消息 "Invalid assignment left-hand side. (line 1, file "B。测试 2")."

您正在 if 语句中进行变量赋值。

尝试使用有效的 js 语法:

   var compareValue = "---- XXXX " + fastRotorValue + " " + medRotorValue + " " + slowRotorValue;
    if (compareValue === "WEATHER"){
               Logger.log(compareValue + ' === "WEATHER"');
    }