Hi,
I have a problem in this line:
File name is of 6 characters, how this transfer is taking place without a loop?
Hi,
In the above code, I am getting the correct answer. The answer is:
I have problem in understanding the line:
keyWordStr[,[ctr]] = files;//Added
Filename is of 6 characters. But these 6 characters are being stored in one character of keyWordStr[,[ctr]] i.e. keyWordStr[0][0], keyWordStr[1][1], keyWordStr[[2][2]. Somebody please guide me. Zulfi.
I have a problem in this line:
Code:
keyWordStr[[i],[ctr]] = files[i];//Added
JavaScript:
var assert = require('assert');
const path = require("path");
const fs = require("fs");
module.exports = async function(callback)
{
try {
var ctr =0;
const keyWordStr = [[],[]];
const files = new Array("A1.sol","A2.sol", "A3.sol");
for (let i = 0; i < files.length; i++) {
//console.log("Test" + i);
const contractPath = path.resolve('/home/zulfi/Truffle_programs/search_opcode/','contracts',files[i]);
//console.log(files[i]);
keyWordStr[[i],[ctr]] = files[i];//Added
ctr++;
}
console.log("keyWordStr = "+keyWordStr[0]);
console.log("keyWordStr = "+keyWordStr[1]);
console.log("keyWordStr = "+keyWordStr[2]);
}
catch (error) {
console.log(error)
}
callback()
}
Hi,
In the above code, I am getting the correct answer. The answer is:
$ truffle exec 2darrofstr.js
Using network 'development'.
keyWordStr = A1.sol
keyWordStr = A2.sol
keyWordStr = A3.sol
I have problem in understanding the line:
keyWordStr[,[ctr]] = files;//Added
Filename is of 6 characters. But these 6 characters are being stored in one character of keyWordStr[,[ctr]] i.e. keyWordStr[0][0], keyWordStr[1][1], keyWordStr[[2][2]. Somebody please guide me. Zulfi.