Guys I am fetching the data from smart contract and it gives a big number in response, I want to convert it into a normal number so that I can use it in order to create a bar chart. How can this be done?

This is the piece of code I wrote so that I could store the values in an array:
//Creating candidatevoterarray for graph
for (var i =0; i<= 4; i++){
const temparray = this.candidatearray[i]
const count = temparray.voteCount
// this.candidatevotearray.push(count)
console.log(count)
}
as docs https://docs.ethers.io/v5/api/utils/bignumber/ say there is a method .toNumber() in BigNumber
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With