How to check Object is inside Array Or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:14 PM - edited 06-12-2024 02:24 PM
Hi All,
How to check below Obj is inside Array or not
1. obj={"id":"1101"}
return Obj;
2. Obj=[{"id":"1101"}]
return Obj;
How do we know return "Obj " is in inside Array Or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 04:06 PM
Can you try using isArray and see if that works?
https://www.w3schools.com/jsref/jsref_isarray.asp
Ex, I tried this in background script, which returns false.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 05:03 PM
Thanks Sanjay !, it is working as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 07:47 PM
Awesome. Could you please mark my response correct if it worked for you?
Please mark this response as correct or helpful if it assisted you with your question.