I want to display the eth balance "result" which for example, displays from the etherscan API
{
status: "1",
message: "OK",
result: "13386321000069000000000069"
}
Using the Ethereum wallet 0x00000000219ab540356cBB839Cbe05303d7705Fa
but my code returns the Ethereum balance result as 0, when I type into the chrome console from page inspect.
ether.fetchEther("0x00000000219ab540356cBB839Cbe05303d7705Fa")
I'm not sure why status and message are working ok. This is the code I use in a JavaScript file. The Html and CSS file just have skeleton code because I'm checking the JS works first.
let ether = {
fetchEther: function(address)
{
fetch("https://api.etherscan.io/api?module=account&action=balance&address="+address +"tag=latest&apikey=RE98FGG6WVI25619AZKGI6B9IPJS6I64N8"
).then((response) =>response.json())
.then((data)=>this.displayBalance(data));
},
displayBalance: function(data){
const { result } =data;
console.log(result)
}
}