简体   繁体   English

'callCounter' 已声明,但其值从未被读取

[英]'callCounter' is declared but its value is never read

With this code:使用此代码:

  let callCounter = 0;
  callCounter += 1;

I get the error:我得到错误:

callCounter' is assigned a value but never used.eslintno-unused-vars callCounter' 被赋值但从未使用过。eslintno-unused-vars

How can I fix the error?如何修复错误?

You haven't called your variable callCounter anywhere.你还没有在任何地方调用你的变量 callCounter 。

If you do,如果你这样做,

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

Your lint will not complain.您的 lint 不会抱怨。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM