Object property is showing as true but it’s false when I try to do anything with it [duplicate]

I’m trying do make a js chess board, and I only validate the pinned pieces moves, like so:

for (var j = 0; j < moves.length; j++) {
    console.log(this.position[1][moves[j].start])
    console.log(this.position[1][moves[j].start].isPinned)
    if (this.position[1][moves[j].start].isPinned || isInCheck) {
        this.makeMove(moves[j], false);
        // checks if king is in check
        this.unmakeMove(false)
    }
}

The first console.log logs the piece that’s trying to move, wich is an object, and if I manually see it’s “isPinned” key, it’s sometimes true, but even when it is true, the second console.log logs “false”.
I have no idea what is causing that, maybe some of you guys can help me