I'm trying to get an array of Numbers from this function:
function getTimes() public view returns (uint[] memory) {
return times;
}
...Calling the function via web3 like this:
ContractInstance.methods.getTimes().call().then(result => {
console.log(result);
})
..my output is a comma separeted string: 1551744000,1551657600
In order to get an array of Numbers I have to modify the String like this:
var array = result.split(',').map(str => {return Number(str)})
Now I'm getting the required array of Numbers:
[1551744000,1551657600]
I'm asking myself if this is the right way. Am I missing something? Thanks for any help.
solidity: ^0.5.0;
web3: 1.0.0-beta.47
Thanks for creating this issue! Could you please add the version of Web3.js you are using?
Yes, of course. I'm using solidity: ^0.5.0 and web3: 1.0.0-beta.47
Just found out, the issue does not consist with [email protected].