我不知道是什么阻止了换行

I can't figure out what is preventing line wrapping

我在使用库 typed.js 时有一个脚本。我正在尝试输出 3 行 + 1 最后一行。该代码通过输出 2 行 + 1 最后一行来工作。尝试修复它时,代码冻结而没有发送错误。

这个版本的代码没有错误。输出 2 行 + 1。

  const lineNumber = app.id !== 2 ? ++app.id : (app.id += 2);

  setTimeout(() => {
    const typed = new Typed(`#line${lineNumber}`, {
      strings: text,
      typeSpeed: speed,
      onComplete: callback,
    });
  }, timeout);
};

$.getJSON(ipgeolocation, (data) => {
  writeLine(["line1"], 30, () => {
    if (app.skippedIntro) return;

    clearCursor();

    const usernames = ['user', 'dude'];

    const ip = data.ip ? data.ip : usernames[Math.floor(Math.random() * usernames.length)];
    const country = data.country_name ? data.country_name : 'your country';

    writeLine([`line2`], 30, 500, () => {
      if (app.skippedIntro) return;
      
      clearCursor();
        
      writeLine([`start`], 120, 500, () => {
        timeouts.push(
          setTimeout(() => {
            if (app.skippedIntro) return;

            clearCursor();

            setTimeout(() => {
              skipIntro();
            }, 500);
          }, 1000)
        );
      });
    });
  });
});

这个版本的代码不工作。按照思路,应该输出3行+1。 1.

  const lineNumber = app.id !== 2 ? ++app.id : (app.id += 2);

  setTimeout(() => {
    const typed = new Typed(`#line${lineNumber}`, {
      strings: text,
      typeSpeed: speed,
      onComplete: callback,
    });
  }, timeout);
};

$.getJSON(ipgeolocation, (data) => {
  writeLine(["line1"], 30, () => {
    if (app.skippedIntro) return;

    clearCursor();

    const usernames = ['user', 'dude'];

    const ip = data.ip ? data.ip : usernames[Math.floor(Math.random() * usernames.length)];
    const country = data.country_name ? data.country_name : 'your country';

    writeLine([`line2`], 30, 500, () => {
      if (app.skippedIntro) return;
      
      clearCursor();

      writeLine([`line3`], 30, 500, () => {
        if (app.skippedIntro) return;
        
        clearCursor();
        
        writeLine([`start`], 120, 500, () => {
        timeouts.push(
          setTimeout(() => {
            if (app.skippedIntro) return;

            clearCursor();

            setTimeout(() => {
              skipIntro();
            }, 500);
          }, 1000)
        );
        });
      });
    });
  });
});

我们有主要的乐队,当你得到3个时,你需要加2才能学习第5个。

  const lineNumber = app.id !== 3 ? ++app.id : (app.id += 2);