I call this function inside a .then promise
this.retrieveMatches();
this function looks like the following
retrieveMatches: function(){
var tableResult = makeHTMLMatchesTable(fetchMatches());
var matches = document.getElementById('matches')
matches.parentNode.insertBefore(tableResult, matches);
},
this function is just above it:
makeHTMLMatchesTable: function(array){
//does stuff
}
so why does the console say this:
Uncaught (in promise) ReferenceError: makeHTMLMatchesTable is not defined
when it clearly has been defined?
Change this code
retrieveMatches: function(){
var tableResult = makeHTMLMatchesTable(fetchMatches());
var matches = document.getElementById('matches')
matches.parentNode.insertBefore(tableResult, matches);
},
to
retrieveMatches: function(){
var tableResult = this.makeHTMLMatchesTable(fetchMatches());
var matches = document.getElementById('matches')
matches.parentNode.insertBefore(tableResult, matches);
}.bind(this),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.