Issue
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)
}
Solution
as docs https://docs.ethers.io/v5/api/utils/bignumber/ say there is a method .toNumber()
in BigNumber
Answered By - Andrei
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.