The includes() method determines whether an array includes a certain value
Given that your arrays itemize objects, those arrays contain references to objects, not the actual objects.
So includes() can't help here because it can only find one-and-the-same object (because its reference is the same) but it cannot find objects that look the same.
Oh yah, I am self-taught artist and a grandaunt in the internet of things who is building Apps that connect visual arts to software devs. So bring it on n let's go animate the world :)
because i was looking at this kind of approach with includes() to get the Difference between two arrays
const arrA = ['john','matha','lisa','adam']; const arrB = ['tom','andrew','lisa','adam'];
Oh yah, I am self-taught artist and a grandaunt in the internet of things who is building Apps that connect visual arts to software devs. So bring it on n let's go animate the world :)
Array.prototype.includes()
Given that your arrays itemize objects, those arrays contain references to objects, not the actual objects.
So
includes()
can't help here because it can only find one-and-the-same object (because its reference is the same) but it cannot find objects that look the same.I believe what you are looking for is Array.prototype.some().
because i was looking at this kind of approach with includes() to get the Difference between two arrays
const arrA = ['john','matha','lisa','adam']; const arrB = ['tom','andrew','lisa','adam'];
but this seems like it does not work with objects
Otherwise thank very much for your take, helps a lot lot...going to look into the approaches
JavaScript data types and data structures
Strings are a primitive type.
Objects are a structural type.
So with objects you simply have to "dig deeper" until you can compare the primitive types (referenced by the object) that matter to you.
Array.prototype.every()
thank you peerreynders, i like this approach, quiet understandable too, thanks alot for the efforts i am more than ever energised :)