in javascript and in solidity if you need to get gata from array index you can write like that
let data = array[ index ]
but in the testing phase, i saw javascript got data from array like this array ( index )
my array in solidity
address[] public funders;
while testing in hardhat via JS
it("add funders to array funders array", async () => {
await fundMe.fund({ value: sendValue })
let funder = await fundMe.funders(0)
assert.equal(funder, deployer)
})
as i know, in javascript and solidity, array works like that array [ index ]
but how is this working. ?????
it shows error if i use [ ]
to get data from array.