I try to send erc20 tokens in this way
var Tx = require('ethereumjs-tx');
var Web3 = require('web3')
var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/2a7d7b55629d44119f069a9239ea96fd'))
// set token source, destination and amount
var myAddress = ""
var toAddress = ""
var amount = web3.utils.toHex(1e16)
// get transaction count, later will used as nonce
web3.eth.getTransactionCount(myAddress).then(function(v){console.log(v); count = v})
var privateKey = new Buffer('privatekey', 'hex')
var abiArray = abiarray
var contractAddress = ''
var contract = new web3.eth.Contract(abiArray, contractAddress, {from: myAddress})
var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(2 * 1e9),"gasLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contract.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(count)}
var transaction = new Tx(rawTransaction)
transaction.sign(privateKey)
web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
contract.methods.balanceOf(myAddress).call().then(function(balance){console.log(balance)})
but I get an error
var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(2 * 1e9),"ga
sLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contr
act.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(cou
nt)}
^
ReferenceError: count is not defined
What is the problem?