const readData = async () => {
const data = window.contract.methods.getName().call();
document.getElementById("dataArea").innerHTML = `Message is here: ${data}`;
why am i getting the message of Object Promise in ${data}
javascriptsolidityweb3js
const readData = async () => {
const data = window.contract.methods.getName().call();
document.getElementById("dataArea").innerHTML = `Message is here: ${data}`;
why am i getting the message of Object Promise in ${data}
Best Answer
.call()
returns a Promise, you need to wait for it to resolve: