'Why is an Array seen as Object in React Native?

I know this questions has been asked quite some time now, but this behavior is really weird.

I have an Array of Objects (fetched from my Realm Database) with the following structure:

userDates = [{aT: [array], id: "..", ...}, {aT: [array], id: "..", ...}, ...]

I want to filter this array like the following:

const filtered = userDates.filter(x => x.aT.includes("2022-03-01"))

It says "x.aT.includes is not a function". If I run this:

const filtered = userDates.filter(x => console.log(x.aT))

it will print out:

["2022-03-01", "2022-03-02","2022-03-03"]
["2022-03-13", "2022-03-14","2022-03-15", "2022-03-16"]
["2022-04-01", "2022-04-02","2022-04-03"]

"typeof" says: "object" and "Array.isArray" says "false". I'm confused. x.aT is obviously an array.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source