Javascript array index difference from [ ] to ( ) #1176
-
in javascript and in solidity if you need to get gata from array index you can write like that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@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]
} |
Beta Was this translation helpful? Give feedback.
@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: