I have an array that I wish to display on a website, unit public x[31]
. Via web3.js, I can create 32 different calls to x[0] through x[31]. Alternatively, I could add a getter view function to my solidity contract that just presents the array
function showX()
public
view
returns (uint[32] memory Xout)
{
Xout= x;
}
With this function built-in to my solidity contract I would just need to call this once in my javascript file, and then have the array. Thus, I can either push more work onto javascript, or solidity. Is either method more efficient/elegant?