V7010. Return value of the function is required to be utilized.
The analyzer has detected a suspicious method call, the return value of which is ignored. Calling some methods without using their return values is pointless.
The example:
/**
* @param {string} input
* @returns {string}
*/
function escape(input) {
input.replaceAll(";", "\\;")
input.replaceAll(",", "\\,")
return input
}
In this case, the replaceAll method is called, but the call result is ignored. The replaceAll method returns a new string without modifying the original one on which the method was called. As a result, the string containing the necessary modification is not used.
For the modifications to take effect, save the result:
/**
* @param {string} input
* @returns {string}
*/
function escape(input) {
input = input.replaceAll(";", "\\;")
input = input.replaceAll(",", "\\,")
return input
}