Web3.js .toNumber Error – Solving Function Issues

web3js

Strange thing happens with .toNumber function. It works well for account balance, but not for rate / endTime. I can't understand why, because balance is BigNumber and rate property is BigNumber (you can see screenshot). Has anyone similar issue and how it needs to be solved?
I use Truffle 4 + VS Code.

enter image description here

Best Answer

Account balance returns BigNumber.

calls actually return a Promise.

If you do something like this, you should get the result in the console:

ico.rate.call().then(result => result.toNumber())