Guys is there anything similar to mapping in javascript?

My problem is, I have an array of 200 addresses, and I need to fetch the data for those address from a contract. But there might be a duplication of a single address, which would lead to fetching the data twice.

Something similar to mapping will help here as I can mark an address after fetching the data, so that I don't fetch it again.

Oct 12, 2023, 11:39 AM
you can use notepad++ filter for remove duplicate string address
Oct 12, 2023, 12:01 PM
Hey, thanks.
I just now used sort, and then ran a loop to remove them.
It was simple, I was dumb lol 😂
Oct 12, 2023, 12:03 PM
you're looking for an object sir. it functions as a hashmap, where the key of an object is the wallet, and the value is whatever data you use or some flag you want to set for it being processed.
the datastructure itself guarantees uniqueness.
Oct 23, 2023, 9:31 PM
Thanks mate

The main problem for me was the duplicate addresses, which I solved simply by running a loop and removing the duplicate ones.
Oct 24, 2023, 9:41 AM

© 2024 Draquery.com All rights reserved.