I am not so familiar with javascript, and i’m using someone else’s code, and added some new functions with parameters, and it’s throwing the following error
It’s somehow not recognizing the functions with parameters.
Uncaught (in promise) ReferenceError: getNFTNames is not defined
window.App = {
start: function() {
var self = this;
Voting.setProvider(web3.currentProvider);
NFTContract.setProvider(web3.currentProvider);
self.populateNFTs();
},
populateNFTs: function() {
var self = this;
NFTContract.deployed().then(function(contractInstance) {
contractInstance.allNFTs.call().then(function(NFTArray) {
for(let i=0; i < NFTArray.length; i++) {
NFTs[NFTArray[i]] = "tokenID-" + i;
}
console.log("NFT Array = " + JSON.stringify(NFTs));
self.setupNFTRows();
})
})
},
setupNFTRows: function() {
Object.keys(NFTs).forEach(function (NFTid) {
$("#NFT-rows").append(
`<tr id='NFT_ID_${NFTid}'>
<td>NFT_ID_${NFTid}</td>
<td>${this.getNFTNames(NFTid)}</td>
<td>${this.getCreators(NFTid)}</td>
</tr>`);
});
},
getNFTNames:function (nftid){
NFTContract.deployed().then(function(contractInstance) {
contractInstance.getNFTname.call(nftid).then(function(v) {
return v.toString();
});
});
}
}