Unexpected string concatenation
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 }
Unexpected string concatenation
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 }
Unexpected string concatenation
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 }
Description
In ES2015 (ES6), we can use template literals instead of string concatenation.
var str = `Hello, ${name}!`;
Bad Practice
var str = "Hello, " + name + "!";
var str = "Time: " + (12 * 60 * 60 * 1000);
Recommended
var str = "Hello World!";
var str = `Hello, ${name}!`;
var str = `Time: ${12 * 60 * 60 * 1000}`;
var str = "Hello, " + "World!";