声明了“ callCounter”,但从未读取其值

时间:2020-06-10 09:20:57

标签: javascript typescript

使用以下代码:

  let callCounter = 0;
  callCounter += 1;

我得到了错误:

callCounter'被分配了一个值,但从未使用过。eslintno-unused-vars

如何解决该错误?

1 个答案:

答案 0 :(得分:0)

您没有在任何地方调用变量callCounter。

如果这样做,

  let callCounter = 0;
  callCounter += 1;
  console.log(callCounter); //Testing purpose only

您的皮棉不会抱怨。