I have created array as below
["lists", { "getByTitle": "CardOperation" }, "items", { "filter": "Id eq 1" }, { "select": ["Title", "CustomerAge"] }];
Now one key as filter I want find it to know it is exists in array but as it is reserved keyword i cannot search it
I tired
array.filter //not working
array["filter"] // not working
what should i do in this case, I am trying to find out if the array has an object with a key of filter at any index
>Solution :
This is probably what you want:
const hasObject = myArray.find(obj => typeof obj === 'object' && obj !== null && obj["filter"]) ? true : false;
This loops through the array and returns true if an object with key "filter" exists, or otherwise, returns false.