Below is a snippet of TypeScript code from my NextJS application:
const holeSet:any[] = [];
.....
let xx = 1, yy = 2;
holeSet.push({x:xx,y:yy});
xx = 3;
yy = 4;
holeSet.push({x:xx,y:yy});
holeSet.map((e) => {
console.log("element ::"+JSON.stringify(e));
});
const a = 1;
const b = 2;
if (holeSet.includes({x:a.toString(),y:b.toString()}))
console.log("Value {1;2} FOUND !");
Upon executing the code, the following output is generated:
element ::{"x":1,"y":2} element ::{"x":3,"y":4}
Despite expecting the message: Value {1;2} FOUND !
to be displayed, it doesn't appear. What am I doing incorrectly?
Could this be due to a syntax error within the if statement?