Eslint reported an error. 'how to correct baseurl' is assigned a value but never used?

let baseurl = `/search?keyword=${key} `;///"baseurl" is assigned a value but never used  
        baseurl += "&page=1";
        if (this.checkAll === false) {
          baseurl += "&range=";
          for (let i = 0; i < this.checkedParts.length; iPP) {
            if (i === this.checkedParts.length - 1) {
              baseurl += this.checkedParts[i];
            } else {
              baseurl += `${this.checkedParts[i]},`;
            }
          }
        }
Apr.02,2021
Is the

baseurl variable used anywhere after a + = operation? The error will be reported if it is not used.


English is very important to programmers. If this is prompted in Chinese, I think you should know what to do.
Let me help you translate
baseurl assigned a value, but never used it.
do you know how to do this one?


literally, you don't use this variable. In the code you give, baseurl is assigned a variety of values, but does not use baseurl . For example: assigned to other variables, as function parameters.

Menu