I am brand new to Vue and JS, so please bear with me as I ask some "silly" questions.
Within my Vue-Pet-Project, I have implemented a self-authored class module called Sudoku. In this module, I aim to find solutions using backtracking. Upon clicking the "startSearch" button, Vue recognizes it but throws the following error:
vue.esm.js?a026:628 [Vue warn]: Error in v-on handler: "ReferenceError: backtrack is not defined"
found in
---> warn @ vue.esm.js?a026:628 logError @ vue.esm.js?a026:1893 globalHandleError @ vue.esm.js?a026:1888 handleError @ vue.esm.js?a026:1848 invokeWithErrorHandling @ vue.esm.js?a026:1871 invoker @ vue.esm.js?a026:2188 original._wrapper @ vue.esm.js?a026:7559 vue.esm.js?a026:1897 ReferenceError: backtrack is not defined at Sudoku.search (sudoku.js?9ece:4) at VueComponent.startSearchSolutions (App.vue?9c43:74) at click (App.vue?88bf:69) at invokeWithErrorHandling (vue.esm.js?a026:1863) at HTMLButtonElement.invoker (vue.esm.js?a026:2188) at HTMLButtonElement.original._wrapper (vue.esm.js?a026:7559)
despite the fact that this function is indeed declared. Below is the code snippet of my class:
module.exports.Sudoku = class Sudoku
{
[...]
search()
{
console.log("search started")
let results = []
backtrack(this.myNumbers,0,0,results)
return results
}
backtrack(testNumbers,x,y,results)
{
console.log("start backtrack")
//TODO: yet much to do...
if(x===9 && y===9)
{
results.push([...testNumbers])
console.log("result added")
}
}
}
Where did I make a mistake?
Thank you for your assistance!