'How to get balanceOf of tron smart contract

I am using tronlink chrome extension and trying to call balanceOf method of a smart contract. I am very new to smart contract. Unable to find any solution. Please check my code:

let contractDetail = await window.tronWeb.trx.getContract('TG7DLMkJPYeG4QTZ8Qfgk9Mu7ePM5SQpbN');
            let contract = await window.tronWeb.contract(contractDetail.abi.entrys, 'TG7DLMkJPYeG4QTZ8Qfgk9Mu7ePM5SQpbN');
            balance = contract.balanceOf.call('TNkJRejobNuZhV2LiwfGQ7wPNiLtcbDueS');
            console.log(balance)


//Error: Uncaught TypeError: Cannot read property 'call' of undefined


Solution 1:[1]

Use tronWeb.trx.getBalance(CONTRACT_ADDRESS);

Your code should look like

balance = await tronWeb.trx.getBalance('TNkJRejobNuZhV2LiwfGQ7wPNiLtcbDueS');

Solution 2:[2]

balanceOf requires one argument.

'balanceOf(address)'

Instead of

contract.balanceOf.call('TNkJRejobNuZhV2LiwfGQ7wPNiLtcbDueS');

You should pass in the address into balanceOf

contract.balanceOf('TNkJRejobNuZhV2LiwfGQ7wPNiLtcbDueS').call();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 George Michael
Solution 2 Ming