i’m coding a decentralized app and i’m stuck.
Here is my problem : i’m calling with async function and return an array with object :
const result = [
{ trait_type: "Neck Gear", value: "1" },
{ trait_type: "Alpha Score", value: "6" },
{ trait_type: "Generation", value: "Gen 0" },];
I need to access the line “Alpha score”. I have to check if alpha score exist in this object.
So i did this :
async function checkAlpha() {
try {
const checkAlphaTxn = await traitsContract.compileAttributes([4])
.then((result) => {
// console.log(result.hasOwnProperty("Alpha Score")) //return false
console.log(result) //return array above
})
} catch (error) {
console.log(error)
}
}
I wanted to use the .hasOwnProperty() method but it returns to me FALSE. But alpha score value exist.
Thank you in advance for those who can unblock me ! 🙂