I have a bool variable that I have initially declared true.
I have an .on('click')
event that checks if the bool is true and if so, if calls function1
, and function1
sets the bool to false.
If bool is false function2
is called and sets bool to true.
However, the bool is not working as it should and I am a lost for why.
My code is below:
cells.on('click', function(d, i) {
if (d.vis === 'text') {
console.log('test');
if (this.boolGame == true) {
myThis.updateList(d);
console.log('setting false');
} else if (this.boolGame == false) {
myThis.collapseList();
console.log('true');
}
This is a sample of one of the functions
collapseList() {
let gameList = this.tableElements.filter(d => d.value.type == 'games');
console.log(gameList);
// this.tableElements.splice();
console.log('false');
this.boolGame = false;
}