Skip to content

Javascript array index difference from [ ] to ( ) #1176

Discussion options

You must be logged in to vote

@talha-rafique Solidity created getter functions for all public state variables, and in case of array it create a getter function with a index as a parameter, so you can pass the index and get the element from the array. It is same like this:

function getElement(uint256 index) returns (type-of-element) {
   return array[index]
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alymurtazamemon
Comment options

@talha-rafique
Comment options

Answer selected by talha-rafique
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants