[SOLVED] Comparison of same address as string does not match

With javascript I sometimes have this problem. It is certainly the same address, but for some reason they donโ€™t match. I think that some small letters have become capital letters and although by console they are the same in code, they are not.

How can I solve this? To what type of file can I pass to compare properly?

    const owner = await contract.ownerOf(idnft);

    console.log('owner of nft ',owner, accountUser)
    if(accountUser == owner) {
    } else {

Cast to lowercase - Moralis addresses are all lowercase


Both have different case, try make both in lowecase before checking

if(accountUser.toLowerCase() == owner.toLowerCase())
1 Like

Thanks @ivan and @qudusayo