'response' is never reassigned. Use 'const' instead
97
98 try {
99 await Model.findOneAndUpdate({_id: data[i]._id}, {used: true}, {new: true})
100 let response = await web3.eth.sendSignedTransaction('0x' + signedTx.serialize().toString('hex'))101 if(response.transactionHash == null) {
102 console.error('trascation not minded')
103 }
'response' is never reassigned. Use 'const' instead
237
238 console.log('log->signedTx', signedTx)
239 try {
240 let response = await web3.eth.sendSignedTransaction('0x' + signedTx.serialize().toString('hex'))241 if(response.transactionHash == null) {
242 res.status(500).json({ message: `Transaction not mined` })
243 }
'response' is never reassigned. Use 'const' instead
181 console.log('log->signedTx', signedTx)
182
183 try {
184 let response = await web3.eth.sendSignedTransaction('0x' + signedTx.serialize().toString('hex'))185 if(response.transactionHash == null) {
186 res.status(500).json({ message: `Transaction not mined` })
187 }
'flag' is never reassigned. Use 'const' instead
58 }
59 } else {
60 console.log('log->sell action')
61 let flag = true; 62 for(let i=0; i < receipt.logs.length; i++) {
63 const log = receipt.logs[i]
64 console.log('log->log', log)
Description
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
Bad Practice
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
Recommended
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);