Skip to content
Discussion options

You must be logged in to vote

Good question, remember though, in javascript, every smart contract function call is an API call to the smart contract - not the data structure itself.

simpleStorage.people[0].name

the syntax you’re using here is solidity, but you’re writing in JavaScript!

I’m assuming people is your array, so you’d want to do:

simpleStorage.people(0)

and get the name from that object! Could you try that?

Then try:

const person = await simpleStorage.people(0)
const name  = person.name
console.log(name)

And you might find your answer :)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@RevanthGundala
Comment options

@TilakMaddy
Comment options

@TilakMaddy
Comment options

@TilakMaddy
Comment options

@RevanthGundala
Comment options

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