I wrote this function in codepen then where it was working perfectly when I transferred it over to replit if I call the checkColPlacement function in the solve function I get the following error:

TypeError: Cannot read properties of undefined (reading ‘checkColPlacement’)

at pencilArr (/home/runner/boilerplate-project-sudoku-solver/controllers/sudoku-solver.js:163:20)

If I call the function in a console.log with the same initial arguments (puzzleString, a, 1, 1) in the check region function it gives the correct output so it is only undefined when called in the solve function doesn’t make any sense to me.

here is the code of the solve function that is throwing the error:

```
solve(puzzleString) {
let coordinate = ['a1','a2','a3','a4','a5','a6','a7','a8','a9','b1','b2','b3','b4','b5','b6','b7','b8','b9','c1','c2','c3','c4','c5','c6','c7','c8','c9','d1','d2','d3','d4','d5','d6','d7','d8','d9','e1','e2','e3','e4','e5','e6','e7','e8','e9','f1','f2','f3','f4','f5','f6','f7','f8','f9','g1','g2','g3','g4','g5','g6','g7','g8','g9','h1','h2','h3','h4','h5','h6','h7','h8','h9','i1','i2','i3','i4','i5','i6','i7','i8','i9']
/*pencilfunction*/
function pencilArr(puzzleString) {
let pencil = []
for (let j = 0; j <= 80; j++) {
pencil.push([])
if (puzzleString[j] != ".") {
pencil[j].push("solved")
pencil[j].push(puzzleString[j])
}
else {
for (let i = 1; i <= 9; i++) {
console.log(puzzleString)
console.log(coordinate[j][0])
console.log(coordinate[j][1])
console.log(i)
console.log(this.checkColPlacement(puzzleString,"a",1, 1))
let pencilColumn = this.checkColPlacement(puzzleString, coordinate[j][0], coordinate[j][1], i)
let pencilRow = this.checkRowPlacement(puzzleString, coordinate[j][0], coordinate[j][1], i)
let pencilRegion = this.checkRegionPlacement(puzzleString, coordinate[j][0], coordinate[j][1], i)
if (pencilRegion != 'truebox' && pencilColumn != 'truecol' && pencilRow != 'truerow') {
pencil[j].push(i)
}
}
}
```

link to the repit: